[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Re: rand random. You've got to be kidding

Jason Rohwedder

11/28/2006 5:56:00 PM

I haven't played with rand, but

Time.now.to_i

should get you a useful seed value.

-jro



On Nov 28, 2006, at 11:51 AM, Smgspices@aol.com wrote:

> Surely it must be possible to initialize rand with current date and
> time.
> Documents seem to indicate this is done with rand(0) or srand with
> no value. I
> have tried both methods and I get the same tired old sequence of
> numbers. I
> would write my own random number generator except I don't know how
> to get a
> numeric value out of Time.
>
> Charles Gray