|
|
Class: RandomGenerator
Object
|
+--RandomGenerator
- Package:
- stx:libbasic2
- Category:
- Magnitude-Numbers
- Version:
- rev:
1.8
date: 2010/03/31 10:37:41
- user: stefan
- file: RandomGenerator.st directory: libbasic2
- module: stx stc-classLibrary: libbasic2
- Author:
- Stefan Vogel
This is a Random number generator, which uses either a OS random number generator,
or a ST/X internal random number generator.
[instance variables:]
[class variables:]
RandFile the FileStream we get random numbers from
Random
HashRandom
Rc4Stream
adding entropy
-
addEntropy: entropyBytes
-
change & update
-
update: something with: aParameter from: changedObject
-
handle image restarts and flush any device resource handles
initialization
-
initialize
-
want to be informed when returning from snapshot
-
openRandFile
-
try to open a random device
instance creation
-
new
-
return a new random number generator.
Try to get system random numbers from device (e.g. in LINUX).
If no system random nubers are available, fall back to
a cryptographic secure PRNG (part of the extra libcrypt package).
As last resort fallback to the cryptographic insecure linear builtin PRNG
-
random
-
alias for new - protocol compatibility with StreamCiphers
queries
-
randPath
-
path to a file/device that is a source or random numbers
adding entropy
-
addEntropy: entropyBytes
-
add some entropy - ignored here, since I am file based
basic reading
-
nextByte
-
get the next random byte
-
nextBytes: cnt
-
get the next cnt random bytes
-
nextInteger
-
return the next integral random number,
in the range 0 .. 16r3FFFFFFF.
reading
-
next
-
return the next random number in the range 0..1
-
nextBetween: start and: stop
-
return a random number between start and stop.
-
nextBoolean
-
return true or false by random
-
nextCharacters: cnt
-
get the next cnt printable characters.
We answer characters in the ascii range (codepoints 32 - 127)
-
nextIntegerBetween: start and: stop
-
return an integral random number between start and stop
-
nextMatchFor: aNumber
-
generate the next random, return true iff it has the same
value as aNumber. Redefined to avoid endless reading.
writing
-
nextPut: something
-
change the random pool by feeding in something.
Something should be some unpredictable, random event.
Ignored here
-
nextPutAll: something
-
change the random pool by feeding in something.
Something should be some unpredictable, random event.
Ignored here
|