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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
08/23/08 03:43
Read: times


 
#157677 - 8051 random numbers revisted - tested
It was a simple 6 LED project.

Push a button, the LED's flash, then one led lights up representing the random number generated.

set a register with 00 0001
rotate left
check for overflow
reset value if overflow

Running on a AT89C4051 at 12 MHz using assembly language.

Button press interrupts generator and stores number for display after a "random" LED flashing routine (you know, for show).

The project was submitted to a lab in South Africa who tested the unit for randomness and failed their test. 30,000 manual button presses produced a propability that lamp #1 would light up 4% less then the other 5.

I talked to their math expert and he theorizes that the generator was running to fast. I should put a delay (1000 x) into the assembly code slowing the random number generator down.

Any thoughts on this scheme fixing the problem?

I used a ring counter so I could plug the value right into the serial LED driver and display the "win".

The other alternative was to set a seed of #06H and DJNZ the number. Catch it on a button press and convert it to a single bit location for display.

A little more software but I don't see the difference in performance in randomness between RL and DJNZ at effectively 12 MHz.

No time for a hardware change as the testing facility already has the board and expects a software change to fix the problem.

Does anyone have one of those fancy software simulators, and the time, to try both methods and see which one would solve this problem?

List of 28 messages in thread
TopicAuthorDate
8051 random numbers revisted - tested            01/01/70 00:00      
   Just Out Of Curiosity            01/01/70 00:00      
      yes casino            01/01/70 00:00      
   No fancy simulator required            01/01/70 00:00      
      Russ, great info here is MY code            01/01/70 00:00      
         Language-independent method            01/01/70 00:00      
            Oops            01/01/70 00:00      
               Head under arm            01/01/70 00:00      
                  HLL not an option            01/01/70 00:00      
                     HLL was just for example - easy to read            01/01/70 00:00      
         As always: The generation of random numbers ...            01/01/70 00:00      
          what is the need to CLR C            01/01/70 00:00      
            no need            01/01/70 00:00      
      does this solution make sense            01/01/70 00:00      
         Per's idea makes more sense            01/01/70 00:00      
         Don\'t use conditional jumps            01/01/70 00:00      
            Clever!            01/01/70 00:00      
      Converting Assembly to C            01/01/70 00:00      
   what about using the timer?            01/01/70 00:00      
      256 / 6 is a failure            01/01/70 00:00      
   One Suggestion for generating 1 to 6            01/01/70 00:00      
   try to use timer            01/01/70 00:00      
      yes a nice solution            01/01/70 00:00      
         How secure does this have to be ?            01/01/70 00:00      
            not much            01/01/70 00:00      
               Not "how safe?", but "how secure?".            01/01/70 00:00      
                  it passed!            01/01/70 00:00      
                     ALL THE BEST!!!            01/01/70 00:00      

Back to Subject List