Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

random numbers trouble (randomize,random,rand) 1

Status
Not open for further replies.

biot023

Programmer
Nov 8, 2001
403
GB
Hallo.
This is something I've never really sorted:
I need to generate a sequence of random numbers that I can be certain won't repeat every time the program starts from scratch.
I know the randomize() function, but it doesn't seem to be working - perhaps I'm putting it in the wrong place, I don't know.
I also know some people seed the random number generator with the system time, but I've never done this.
Could anyone offer any help?
Cheers,
Douglas JL

Common sense is what tells you the world is flat.
 
use rand and srand. srand initializes rand, so you should initialize it with timestamp.

Ion Filipski
1c.bmp
 
Thanks alot, man!

Common sense is what tells you the world is flat.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top