You could use my dire hack below which should avoid the the problem (though your interval will now be (0,1]), but I haven't tested what effects it might have on the random number generation in general. YMMV.
-- Dwight
'From Squeak 2.4c of May 10, 1999 on 25 May 1999 at 1:41:28 pm'!
!Random methodsFor: 'as yet unclassified' stamp: 'dwh 5/25/1999 13:34'! next " This method generates random instances of Float in the interval 0 to 1. " seed := self nextValue. (seed = m) ifTrue: [seed := seed - 1.0]. ^seed / m! !
Juan Cires Martinez wrote:
Hello:
I am using a lot of Randoms lately, and something strange has happened a couple of times today: I get Randoms which after a while produce an unending sequence of 1.0s. The instance variables of these Randoms are:
seed: 2.147483647e9 a: 16807.0 m: 2.147483647e9 q: 127773.0 r: 2836.0
It is quite annoying. I do not know the details of the random number generation algorithm. Is there a way to avoid it besides explicit testing for 1.0 in Random>>next?
Thanks, Juan.