Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
02/15/10 09:04
Read: times


 
#173167 - random and pseudorandom
Responding to: ???'s previous message
Vijay Singh said:
How to generate random numbers in 8051 using timer, each after 1 sec such that the sequence is not always the same when i turn the display on and also the number does not repeat itself.

Algorithms which are purely computational are only pseudo-random number generators (pRNG). However, they are a good start. Two commonly used algorithms are linear-congruent (LC RNG) and linear feedback shift register (LFSR RNG) - search 8052.com and/or the net for details (wikipedia has a lot of information).

Although there are more "serious" pRNG algorithms, often based on cryptography, not without reason; nevertheless, none of them will guarantee you what you require - the sequence they generate are deterministic. You need either a physical source of randomness - some sort of noise, or a "human" input, or some sort of communication from a connected but independent system - and "mix" it into the pRNG's stream in an appropriate way. If you have some nonvolatile memory in your system, you can use it as a method for continuous pRNG stream generation across power down periods, avoiding the problem of inadvertent improper "seeding" upon powerup/reset.

There's much more to good RNG than what was said above, but this should give you at least the basic ideas you asked for.

As Andy said above, search this forum, this topic has been discussed in details many many times.

JW



List of 7 messages in thread
TopicAuthorDate
Need Some Ideas            01/01/70 00:00      
   Look at Kai's User Page...            01/01/70 00:00      
      It's here...            01/01/70 00:00      
   Here's an idea            01/01/70 00:00      
   random and pseudorandom            01/01/70 00:00      
   have you seen this Link            01/01/70 00:00      
      random number generator...            01/01/70 00:00      

Back to Subject List