Random.st
changeset 973 ec6bced2d1f5
parent 947 23faa406af1f
child 978 5a4c98ef6584
equal deleted inserted replaced
972:bd3e3259987c 973:ec6bced2d1f5
    26 
    26 
    27 "{ Package: 'stx:libbasic2' }"
    27 "{ Package: 'stx:libbasic2' }"
    28 
    28 
    29 Stream subclass:#Random
    29 Stream subclass:#Random
    30 	instanceVariableNames:'seed increment multiplier modulus'
    30 	instanceVariableNames:'seed increment multiplier modulus'
    31 	classVariableNames:'RandomGenerator'
    31 	classVariableNames:'RandomGenerator RandomSalt'
    32 	poolDictionaries:''
    32 	poolDictionaries:''
    33 	category:'Magnitude-Numbers'
    33 	category:'Magnitude-Numbers'
    34 !
    34 !
    35 
    35 
    36 !Random class methodsFor:'documentation'!
    36 !Random class methodsFor:'documentation'!
   500 
   500 
   501      These numbers are carefully choosen, so don't change them, 
   501      These numbers are carefully choosen, so don't change them, 
   502      unless you know what you are doing!!"
   502      unless you know what you are doing!!"
   503 
   503 
   504     seed := Time millisecondClockValue bitAnd:16rFFFF.
   504     seed := Time millisecondClockValue bitAnd:16rFFFF.
       
   505     RandomSalt isNil ifTrue:[
       
   506         RandomSalt := 1.
       
   507     ].
       
   508     seed := seed + RandomSalt.
   505     multiplier := 1597.
   509     multiplier := 1597.
   506     increment := 51749.
   510     increment := 51749.
   507     modulus := 244944.
   511     modulus := 244944.
   508 
   512 
   509     "Modified: / 1.4.1997 / 22:44:13 / cg"
   513     "Modified: / 1.4.1997 / 22:44:13 / cg"
   539 ! !
   543 ! !
   540 
   544 
   541 !Random class methodsFor:'documentation'!
   545 !Random class methodsFor:'documentation'!
   542 
   546 
   543 version
   547 version
   544     ^ '$Header: /cvs/stx/stx/libbasic2/Random.st,v 1.27 2000-12-20 18:46:53 cg Exp $'
   548     ^ '$Header: /cvs/stx/stx/libbasic2/Random.st,v 1.28 2001-08-22 18:26:54 cg Exp $'
   545 ! !
   549 ! !