From: Orion Hunter Date: 2003-07-30T03:55:55+09:00 Subject: Re: Generating random numbers? The only thing it was being used for was for grabbing the element at that index in an array. I managed to figure out the problem though. I was using Kernel.srand( Time.now.usec ) in a function that was executed previous to the one where I was having a problem. Why this would result in duplicate sequential values, I'm not sure. All I know is by taking srand out of a completely different function, it fixed the problem. Matt >From: matz@ruby-lang.org (Yukihiro Matsumoto) >Reply-To: ruby-talk@ruby-lang.org >To: ruby-talk@ruby-lang.org (ruby-talk ML) >Subject: Re: Generating random numbers? >Date: Wed, 30 Jul 2003 03:22:22 +0900 > >Hi, > >In message "Re: Generating random numbers?" > on 03/07/30, "Orion Hunter" writes: > >|My problem is that I am getting the same "random number" repeated in >|sequence. For example, my code looks something like this >| >|100.times{ >| rand = Kernel.rand( 50 ) >| ... #do something with the random number >|} >| >|And I end up getting a sequence of random numbers like this: >|5,5,5,5,5,5,5,5,89,89,89,89,89,2,2,2,78,78,78,78,44,44,44,44,44... etc > >No one can answer for you unless you reveal "something with the random >number". This is the first report of such randomness problem. >I suspect a bug in your code. > > matz. > _________________________________________________________________ Help STOP SPAM with the new MSN 8 and get 2 months FREE* http://join.msn.com/?page=features/junkmail