--- a/Random.st Tue Dec 29 12:38:06 2015 +0100
+++ b/Random.st Tue Dec 29 21:06:03 2015 +0100
@@ -25,6 +25,8 @@
"
"{ Package: 'stx:libbasic2' }"
+"{ NameSpace: Smalltalk }"
+
Stream subclass:#Random
instanceVariableNames:'seed increment multiplier modulus'
classVariableNames:'SharedGenerator RandomSalt'
@@ -421,7 +423,7 @@
!Random methodsFor:'accessing-reading'!
next
- "return the next random number in the range 0..1"
+ "return the next random number in the range ]0..1["
self step.
^ seed / modulus asFloat
@@ -439,7 +441,7 @@
!
nextBetween:start and:stop
- "return a random number between start and stop.
+ "return a random number in the range ]start..stop[.
claus: the original GNU version has a bug in returning values
from the interval [start .. stop+1]"
@@ -650,8 +652,14 @@
TestCase assert:(bag standardDeviation closeTo:(((400000 squared - 1)/12) sqrt)).
"
-
- "Modified: / 21.8.1998 / 14:45:04 / cg"
+ "
+ |r|
+
+ r := self new.
+ 100000000 timesRepeat:[
+ self assert:((r nextIntegerBetween:1 and:3) between:1 and:3).
+ ].
+ "
! !
!Random methodsFor:'blocked methods'!
@@ -758,10 +766,10 @@
!Random class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic2/Random.st,v 1.57 2014-10-02 17:56:20 stefan Exp $'
+ ^ '$Header$'
!
version_CVS
- ^ '$Header: /cvs/stx/stx/libbasic2/Random.st,v 1.57 2014-10-02 17:56:20 stefan Exp $'
+ ^ '$Header$'
! !