of course, be pseudo-random (not really random). most PRNG's in
compilers are linear congruential generators (LCG) which take the
form of:
Code:
X[n] = a * X[n-1] + b mod M
referred to the randomness "deteorating" but most LCD's will just
begin to repeat after Y digits (depends on the values of a, b
and M) (Y is usually not as large as 2^32, so I'm kind of
curious as to what type of rng pb uses). additionally, there
are combined lcg's which use multiple LCG's in conjunction which
will increase the period. but it's still cryptographically
weak.
for those of you concerned with security LCG's are *not* the way
to go. LCG's are easily predictable, and linear feedback shift
registers (LFSR) are pretty bad too (unless designed correctly
which is a pretty difficult feat). there are several PRNG's
that are cryptographically secure, such as Blum Blum Shub which
is essentially:
Code:
seeding: X[0] = x^2 mod n where x is relatively prime to n. generator: X[n] = X[n-1]^2 mod n where n is the product of 2 large primes which are congruent to 3 mod 4.
unpredictable in both directions so it's perfect for security
applications.
------------------
Leave a comment: