| ??? 05/10/00 20:51 Read: times |
#2642 - RE: Generating random numbers |
Erik,
We discussed this recently in a series of messages initiated by Simon Chang, page back to 4/18 "Programming a Memory Game." There are several techniques depending upon your application. If you need to do Monte Carlo simulations that are not triggered by external events then you need a proper pseudo random number generator but generally if you do, you might not need to be using an 8051. It you just need some light randomizing, a common technique to use a timer running circular and fast. A random external event such as a human keystroke after debounce is used to grab the timer value and scale it to the range. The caveat is to not use events that are tied to each other (violates the independence principle in stats). Be careful how you scale the to the range you need - most people violate the distribution principle in the shortcuts they use to chop it to size. If you need randomizing for hashing codes, often an input value is maniulated with a combination of xor, shift and increment. Since its dependent on the input records, trial and error are generally used but you should check you depth-to-find rate before you validate the routine. Tell us more about your application and we can be more specific and maybe even helpful. :-) -Jay C. Box |
| Topic | Author | Date |
| Generating random numbers | 01/01/70 00:00 | |
| RE: Generating random numbers | 01/01/70 00:00 | |
| RE: Generating random numbers | 01/01/70 00:00 | |
| RE: Generating random numbers | 01/01/70 00:00 | |
RE: Generating random numbers | 01/01/70 00:00 |



