go_away

Author Topic: "Random" Number Generator  (Read 2051 times)

0 Members and 1 Guest are viewing this topic.

Offline airman00Topic starter

  • Contest Winner
  • Supreme Robot
  • ****
  • Posts: 3,653
  • Helpful? 21
  • narobo.com
"Random" Number Generator
« on: June 29, 2008, 08:41:46 AM »
I understand how hardware based "random" number generators work but can someone please explain to me how software-based generators work. I've looked it up but I don't really understand it , can someone please explain it.

and I am not talking about having a list of random numbers and then picking from that list, im talking about a mathematical algorithm that produces a number that seems to be "random"

and I am definitely not talking about this:      :D :D

Check out the Roboduino, Arduino-compatible board!


Link: http://curiousinventor.com/kits/roboduino

www.Narobo.com

Offline ahab

  • Jr. Member
  • **
  • Posts: 18
  • Helpful? 0
Re: "Random" Number Generator
« Reply #1 on: June 29, 2008, 10:08:29 AM »
Some of them are based on the system clock.

Offline airman00Topic starter

  • Contest Winner
  • Supreme Robot
  • ****
  • Posts: 3,653
  • Helpful? 21
  • narobo.com
Re: "Random" Number Generator
« Reply #2 on: June 29, 2008, 10:17:20 AM »
Some of them are based on the system clock.

I understand that , but that is considered hardware based

How does a random number generator mathematical algorithm work?
Check out the Roboduino, Arduino-compatible board!


Link: http://curiousinventor.com/kits/roboduino

www.Narobo.com

Offline izua

  • Supreme Robot
  • *****
  • Posts: 682
  • Helpful? 0
Re: "Random" Number Generator
« Reply #3 on: June 29, 2008, 11:13:06 AM »
there is no such thing as a software random number generator.
numbers generated by software will be pseudorandom numbers. what this means is all the numbers are part of a sequence. given enough numbers, the sequence will emerge. think of it as a very long period (i'm talking about the math thing at fractional numbers). it might be very long, but after a while, it repeats.

to start every time at a different position, a "seed" or initial value is used. starting a timer on your microcontroller, waiting for a "start" key, and using the timer value as an input is a pretty good initial seed.

the basic pseudorandom generators are called linear feedback shift registers. think of them as a function that has an input, does some xoring, shifting (actually, it's barrel shifting) and a bunch of more logical operations on that input, and then returns it as an output. if you pass it again, you will get another pseudorandom value. if you pass it sufficient times, a pattern will emerge.

a true random number generator for 8 bits value will not generate any pattern after an infinite number of calls.
this is a nice design i plan on using someday. it's based on reverse avalanche noise generated by an inverse polarised pn junction. i believe a diode will work equally well.
« Last Edit: June 29, 2008, 11:14:22 AM by izua »
Check out my homepage for in depth tutorials on microcontrollers and electronics.

Offline hgordon

  • Expert Roboticist
  • Supreme Robot
  • *****
  • Posts: 373
  • Helpful? 7
Re: "Random" Number Generator
« Reply #4 on: June 29, 2008, 11:15:15 AM »
I have used the pseudo-random number generator - the results are reasonable and the code is simple -

  http://inglorion.net/software/deadbeef_rand/
Surveyor Corporation
  www.surveyor.com

Offline airman00Topic starter

  • Contest Winner
  • Supreme Robot
  • ****
  • Posts: 3,653
  • Helpful? 21
  • narobo.com
Re: "Random" Number Generator
« Reply #5 on: June 29, 2008, 12:30:46 PM »
Thank you , I understand now
Check out the Roboduino, Arduino-compatible board!


Link: http://curiousinventor.com/kits/roboduino

www.Narobo.com

 


Get Your Ad Here

data_list