Random number seed

Random number seed

Post by MR T Needh » Thu, 24 Oct 1996 04:00:00



Can anyone tell me what is usualy used as the seed for srand(unsigned int)
ATM I'm using

 srand((unsigned int)time())

but I've got the feeling that's not the best way to do it.

--

Thomas Needham (Mandrake)

http://metro.turnpike.net/metro/Mandrake

 
 
 

Random number seed

Post by Per Erik Jor » Thu, 24 Oct 1996 04:00:00



|> Can anyone tell me what is usualy used as the seed for srand(unsigned int)
|> ATM I'm using
|>
|>  srand((unsigned int)time())
|>
|> but I've got the feeling that's not the best way to do it.
|>

There is a lot more to "random" number generation than rand().

Take a look at http://www.taygeta.com/random.html  
for discussions and links.

(Be sure to read the section: "Whats all the fuss about ?
 Why can't I just use the PRNG that came with my compiler ?")

Per Erik Jorde
Division of Zoology, University of Oslo, Norway
P.O.Box 1050 Blindern, N-0316 Oslo, Norway


 
 
 

Random number seed

Post by Leo Bud » Fri, 25 Oct 1996 04:00:00


I am porting SunOs application that has imbedded sql to access sybase database.  It uses dblib (from Sybase) and rwdb (from Rogue Wave) to read and write the data.
I would like to use some relational database on linux to store the data.  Preferably I don't want to re-write the sql code, but I am willing to do so if necessary.

Has anyone done something like this?  If so, what database was used and how easy(difficult) was the port?

###############################
Leo Budin
Phone: (212) 409-3552

###############################
--

###############################
Leo Budin
BlackRock Financial Management
345 Park Avenue, 30th Floor
New York, NY 10154

Phone: (212) 409-3552
Fax:   (212) 754-5397

###############################

 
 
 

Random number seed

Post by David Rudd » Sat, 26 Oct 1996 04:00:00



: Can anyone tell me what is usualy used as the seed for srand(unsigned int)
: ATM I'm using

:  srand((unsigned int)time())

: but I've got the feeling that's not the best way to do it.

It depends on what your application is.  If you're making a game, then
this should be fine.  If you are making an encryption algorithm, this is
not okay.  Basically, if you think that there is a problem with the
random stream being hacked, then make a stronger PRNG.

The way I'm currently doing a cryptographically secure PRNG is:
 (oh...I'm doing this in Java)
Throw up a window.
Record mouse movements in it
Hash the mouse movements with SHA-1
Use the hashed output of SHA-1 as the key to RC4.
Send the RC4 an one-byte Initialization Vector
Use the output of the RC5 as the random number stream
also use that as the next block to encrypt.

mouse movements are sufficiently random for the SHA-1 seed
SHA-1 produces a cryptographically sound random seed
RC4 is decently fast and can work a byte at a time

But, for a game, this is totally overkill.

: --

: Thomas Needham (Mandrake)

: http://metro.turnpike.net/metro/Mandrake

--
                        -Dave

I got a coffee mug from Cray Research when they moved out.  Now I can
drink my coffee while doing 63 other, unrelated tasks.

 
 
 

1. different seed for random number generator?

hi,
        can anyone tell me how I can generate a different seed if I run
srand(time(NULL)); more than one time in a second? I wrote an application
to print out a random number..if I run the application fast enough,
it will print a same number until the next second.. anyone know how I can
fix this?

Thanks in advance

Dan

2. nasty problem after cvsup yesterday

3. What is a good random seed?

4. C/C++ developing

5. Random Number generator not Random *****

6. gopherd

7. Seeds for random nos.

8. X on Portege T3400

9. Trying to generate random random numbers!

10. Finding the random seed

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

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

13. getting random numbers