Object subclass: #Random
  instanceVariableNames: 'seed '
  classVariableNames: 'M C A ' poolDictionaries: ''    !

!Random class methods !
  
new
    (A isNil)
        ifTrue: [ M := 2 raisedToInteger: 35.
                  C := 541. "should be relatively prime to M"
                  A := 315159621].
    ^ super new initialize! !

!Random methods !
  
initialize
    self seed: 0.5714159!

next
    "ENSURES: result is a random floating point number between 0 and 1"
    seed := (A * seed + C) rem: M.
    ^ (seed /  M) asFloat!
   
randInteger: size
    self error: 'this message deleted, use Uniform Discrete instead'!

seed: anInteger
    seed := (1 max: anInteger).! !
