what's the accepted method to get a random seed?

what's the accepted method to get a random seed?

Post by Jay G. Sco » Sun, 05 Feb 2006 04:03:13



i considered using seconds since the epoch, that may be good enough.

ummmm, by the way, is rand() still the way to go?  in the end i'm going
to want a random real between zero and one inclusive.   [0,1] as
the mathematicians say.

anyway, to seed rand() you need an unsigned int.  all i really want
is "not readily predictable" garbage.  seems like i heard of someone
just reading something out of the kernel, maybe the process table?

--

Head of Sun Support, Sr. Operating Systems Specialist
Applied Research Labs, Computer Science Div.                   S224
University of Texas at Austin

 
 
 

what's the accepted method to get a random seed?

Post by Chris Thomps » Sun, 05 Feb 2006 05:24:34




Quote:

>i considered using seconds since the epoch, that may be good enough.

>ummmm, by the way, is rand() still the way to go?  in the end i'm going
>to want a random real between zero and one inclusive.   [0,1] as
>the mathematicians say.

>anyway, to seed rand() you need an unsigned int.  all i really want
>is "not readily predictable" garbage.  seems like i heard of someone
>just reading something out of the kernel, maybe the process table?

Read sizeof(int) bytes from /dev/urandom. Or are you using some horribly
ancient version of Solaris that doesn't have it?

--
Chris Thompson
Email: cet1 [at] cam.ac.uk

 
 
 

what's the accepted method to get a random seed?

Post by Jay G. Sco » Sun, 05 Feb 2006 05:39:19






>>i considered using seconds since the epoch, that may be good enough.

>>ummmm, by the way, is rand() still the way to go?  in the end i'm going
>>to want a random real between zero and one inclusive.   [0,1] as
>>the mathematicians say.

>>anyway, to seed rand() you need an unsigned int.  all i really want
>>is "not readily predictable" garbage.  seems like i heard of someone
>>just reading something out of the kernel, maybe the process table?

>Read sizeof(int) bytes from /dev/urandom. Or are you using some horribly
>ancient version of Solaris that doesn't have it?

GACK!  i used to have to install /dev/urandom from the source, too.
completely whiffed on that one.  thanks.

j.

Quote:

>--
>Chris Thompson
>Email: cet1 [at] cam.ac.uk

--

Head of Sun Support, Sr. Operating Systems Specialist
Applied Research Labs, Computer Science Div.                   S224
University of Texas at Austin
 
 
 

1. What is a good random seed?

Is there a way to have a more random way to seed RANDOM?

Now I do RANDOM=(multiply part of the CPU number * part of time * Process
Id) % 32767

A better way would be to make a number by testing CPU usage and generate a 1
when it increases and a 0 when it doesn't.  But this is prettty involved for
the ksh and it only works for busy systems.

This has to run only once on different systems.

2. Linux Journal magazine

3. Seeds for random nos.

4. RPM problems

5. Finding the random seed

6. Need help installing Mandrake 8.1---I am lost

7. different seed for random number generator?

8. Faulty CPU?

9. SUMMARY: get the time of the day to seed my random generator

10. Random number seed

11. Preferred method of getting the user's email address

12. How to accept method POST ?

13. Random problems with accepting connections