From: "George Spelvin" <linux@horizon.com>
To: tytso@mit.edu
Cc: linux@horizon.com, linux-kernel@vger.kernel.org
Subject: Replace /dev/random input mix polynomial with Brent's xorgen?
Date: 14 Dec 2013 04:06:07 -0500 [thread overview]
Message-ID: <20131214090607.30797.qmail@science.horizon.com> (raw)
Richard Brent extended some efficient XOR-based PRNGs designed by George
Marsaglia into a family of "xorgen" generators which are efficent,
non-sparse, maximal-period polynomials of length 64, 128, 256,... 4096
bits.
(It ends there because proving period 2^n-1 requires knowing the
factorization of 2^n-1, and 2^8192-1 = (2^4096+1)*(2^2048+1)*...*(2^1+1).
The factorization of 2^4096+1 = F_12 is currently stuck on an 1133-digit
composite residue; see http://caramel.loria.fr/f12.txt)
http://maths-people.anu.edu.au/~brent/pub/pub224.html
"Some long-period random number generators using shifts and xors",
Related background papers:
http://www.jstatsoft.org/v08/i14/paper
"Xorshift RNGs"
http://maths-people.anu.edu.au/~brent/pub/pub218.html
"Note on Marsaglia's xorshift RNGs"
Anyway, the algorithm boils down to
t1 = x[i-r]; t2 = x[i-s];
t1 ^= t1 << a; t2 ^= t2 << c;
t1 ^= t1 >> b; t2 ^= t2 >> d;
x[i] = t1 ^ t2;
For various constants r = 2..128, s < r, and shifts a, b, c and d.
Both 32- and 64-bit versions are included.
This is both more efficient and (especually using 64-bit words) more
thorough than the current code, for sizes up to 4096 bits. Although the
current code has tables for larger pools, everything larger than 32x128 =
4096 bits is currenty commented out and not used.
Would you be interested in a patch to revise _mix_pool_bytes()?
I'm also thinking of revising the input rotate-by-7 to use
Marsaglia's original xorshift as a whitener.
next reply other threads:[~2013-12-14 9:06 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-14 9:06 George Spelvin [this message]
2013-12-14 19:23 ` Theodore Ts'o
2013-12-14 21:55 ` George Spelvin
2013-12-15 2:21 ` Theodore Ts'o
2013-12-15 8:34 ` George Spelvin
2013-12-15 22:19 ` Theodore Ts'o
2013-12-16 4:22 ` George Spelvin
2013-12-16 6:43 ` Theodore Ts'o
2013-12-16 6:49 ` Theodore Ts'o
2013-12-16 15:03 ` George Spelvin
2013-12-15 20:03 ` Greg Price
2013-12-15 22:09 ` George Spelvin
2013-12-16 0:32 ` Greg Price
2013-12-16 6:53 ` George Spelvin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20131214090607.30797.qmail@science.horizon.com \
--to=linux@horizon.com \
--cc=linux-kernel@vger.kernel.org \
--cc=tytso@mit.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome