RandomTools[QuadraticCongruence][NewGenerator] - Quadratic Congruence Pseudo Random Number Generator
|
Calling Sequence
|
|
NewGenerator( opt1, opt2, ... )
|
|
Parameters
|
|
opt1, opt2, ...
|
-
|
(optional) argument of the form option=value where option is one of primes, range, or seed
|
|
|
|
|
Description
|
|
•
|
The NewGenerator command outputs a Maple procedure, a pseudo-random number generator, which when called outputs one pseudo-random integer. The output of the generator depends on the options described below. The default is to output integers on the range , i.e., a random 12 digit integer.
|
•
|
The quality of the pseudo-random numbers generated is expected to be good because the least significant bits of the are cryptographically secure. See RandomTools[BlumBlumShub].
|
p
|
q
|
(9999948359)
|
(9999854759)
|
(999999911447)
|
(999999811607)
|
(999999999847799)
|
(999999999771959)
|
(9999999999716999)
|
(9999999999691319)
|
|
|
|
Thus there are four choices of n available which have lengths 20, 24, 30, and 32 digits respectively with periods > 10^19, 10^23, 10^29 and 10^31, respectively. The larger primes will give ``better'' pseudo-random numbers and provide a longer the period. For most applications the smallest choice, the default, will be fine and it will be slightly faster than the larger choices.
|
•
|
The following optional arguments are supported. They are input as equations in any order.
|
•
|
range=integer..integer or integer
|
|
If the value of the range argument is a range, then the integer will be chosen from that range. If the value of the range argument is an integer, then the integer will be take from the range [0..value). The default range is .
|
|
The integer l, which must be one of 10, 12, 15 and 16 specifies the choice of the length of the primes p and q in decimal digits. The default value for primes in .
|
|
|
Examples
|
|
>
|
|
| (1) |
>
|
|
| (2) |
>
|
|
| (3) |
>
|
|
| (4) |
>
|
|
| (5) |
>
|
|
| (6) |
>
|
|
| (7) |
>
|
|
| (8) |
>
|
|
| (9) |
>
|
|
| (10) |
>
|
|
| (11) |
|
|