aspose file tools
The moose likes Beginning Java and the fly likes Pseudo Random Numbers Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Badass: Making Users Awesome this week in the Game Development forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Pseudo Random Numbers" Watch "Pseudo Random Numbers" New topic

Pseudo Random Numbers

Muhammad Ali

Joined: Dec 04, 2000
Posts: 28
Actually, the random numbers that come up when you start your program cannot be different if you use THE SAME SEED NUMBER every time. All random number algorithms require a starting number to generate a non-repeating list of numbers. However, if you give the same seed number, the non-repeating list will be same for every execution of the program.
In practical programs we use the system date and time as the starting seed value. Since date and time will always be different when you run your program, each run of your program will get a different seed value and hence it will generate a different non-repeating list.
Muhammad Ali Shah
FAST Institute of Computer Science, Karachi.
Cindy Glass
"The Hood"

Joined: Sep 29, 2000
Posts: 8521
That's a great idea.

"JavaRanch, where the deer and the Certified play" - David O'Meara
Steve Fahlbusch

Joined: Sep 18, 2000
Posts: 591

Actually, most random number generators (pseudo-random number generators) create lists of repeating random number. That is, for every seed, one will obtain the same list of numbers until the list starts to repeat.
That is why if "randomness" is important, one usually performs a chi-squared analysis on a set of seeds from which one selects a pool to pick from. I have seen many random number generators that will create lists lengths of > 2000 numbers before repeating while creating at the same time create hundreds of lists with lenghts of 2, 3 and 4 numbers that start to repeat.
Again, if it not really important (like a game) no problem. If it is important like a simulation that will used to base decisions upon, the analysis should be done. And if it is really important, like a slot machine or an electronic poker machine, then one needs to go to a "hardware" addon solution or a reseed every so often approch.

[This message has been edited by Steve Fahlbusch (edited February 02, 2001).]
I agree. Here's the link:
subject: Pseudo Random Numbers