• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

Pseudo Random Numbers

 
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
"The Hood"
Posts: 8521
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That's a great idea.
 
Bartender
Posts: 612
7
Mac OS X Python
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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).]
 
Too many men are afraid of being fools - Henry Ford. Foolish tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic