add salt to seed (in case random generators are created
authorClaus Gittinger <cg@exept.de>
Wed, 22 Aug 2001 20:26:54 +0200
changeset 973 ec6bced2d1f5
parent 972 bd3e3259987c
child 974 c4be514ddd96
add salt to seed (in case random generators are created fast - within the same millisecond)
Random.st
--- a/Random.st	Tue Aug 21 17:52:19 2001 +0200
+++ b/Random.st	Wed Aug 22 20:26:54 2001 +0200
@@ -28,7 +28,7 @@
 
 Stream subclass:#Random
 	instanceVariableNames:'seed increment multiplier modulus'
-	classVariableNames:'RandomGenerator'
+	classVariableNames:'RandomGenerator RandomSalt'
 	poolDictionaries:''
 	category:'Magnitude-Numbers'
 !
@@ -502,6 +502,10 @@
      unless you know what you are doing!!"
 
     seed := Time millisecondClockValue bitAnd:16rFFFF.
+    RandomSalt isNil ifTrue:[
+        RandomSalt := 1.
+    ].
+    seed := seed + RandomSalt.
     multiplier := 1597.
     increment := 51749.
     modulus := 244944.
@@ -541,5 +545,5 @@
 !Random class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic2/Random.st,v 1.27 2000-12-20 18:46:53 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic2/Random.st,v 1.28 2001-08-22 18:26:54 cg Exp $'
 ! !