|
Class: RandomBlumBlumShub
Object
|
+--RandomBlumBlumShub
- Package:
- stx:libbasic2
- Category:
- Magnitude-Numbers-Random
- Version:
- rev:
1.6
date: 2021/01/20 13:06:38
- user: cg
- file: RandomBlumBlumShub.st directory: libbasic2
- module: stx stc-classLibrary: libbasic2
NO WARRANTY
This generator uses the blum blub shub algorithm to generate random numbers.
It is very slow, but considered to provide good random numbers.
RandomBlumBlumShub new nextInteger
copyrightCOPYRIGHT (c) 2014 Claus Gittinger
All Rights Reserved
This software is furnished under a license and may be used
only in accordance with the terms of that license and with the
inclusion of the above copyright notice. This software may not
be provided or otherwise made available to, or used by, any
other person. No title to or ownership of the software is
hereby transferred.
instance creation
-
new
-
(comment from inherited method)
return an instance of myself without indexed variables
-
new: seed
-
(comment from inherited method)
return an instance of myself with anInteger indexed variables
initialization
-
initialize
-
The two primes, p and q, should both be congruent to 3 (mod 4)
Usage example(s):
-
seed: seedArg
-
isCoprimeWith:
random numbers
-
nextBoolean
-
generates the next random boolean
-
nextInteger
-
generates the next integer in 0..FFFFFFFF
Usage example(s):
self new nextInteger.
|r|
r := self new
100 timesRepeat:[ Transcript showCR:r nextInteger].
|
|