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

**URL:** <https://www.ruby-forum.com/t/re-rand-random-youve-got-to-be-kidding/77554>\
**Category:** Ruby\
**Created:** [November 28, 2006, 7:58pm UTC](https://www.ruby-forum.com/t/re-rand-random-youve-got-to-be-kidding/77554 "2006-11-28T19:58:11Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![unknown](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/4bbf92/32.png) [@unknown](https://www.ruby-forum.com/u/unknown)\
**Post date:** [November 28, 2006, 7:58pm UTC](https://www.ruby-forum.com/t/re-rand-random-youve-got-to-be-kidding/77554/1 "2006-11-28T19:58:11Z")

</div>

In a message dated 11/28/2006 11:47:44 A.M. US Mountain Standard Tim,  
removed\_email\_address@domain.invalid writes:

> 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.

On windows I think there is no way to seed from /dev/urandom, so you  
get seeded by some default value. Instead the seed is composed of  
the current time in seconds and microseconds and the pid.

It could be that the problem exists because I am running windows. I’d  
run it  
in Linux except I couldn’t figure out how to get Ruby to work in Linux.  
I am  
a Linux newby as well as a Ruby newby :-). The problem also might be in  
the  
file.sort{rand} method.
