Software > Software
pseudo-random no. generator
(1/1)
khurlan:
i'm a noob in PICs andi need to create a pseudo-random number generator using PICmicrocontroller. It actually works just like an LFSR.
I'm using PIC16F877A and MPLab IDE sofware. I'm also using the PICClite compiler. I nid a program in C .
Can anybody helpme with the source code?
Dr_Worm:
I'm not sure this will help you but its in C++ and is a PRNG - http://www.bedaux.net/mtrand/
Admin:
What about reading from a list of "random" numbers? this is the old fashion way of doing it . . .
You can also poll from the timer, analog port . . .
Or say multiply a number from the 'random list' by the timer, then divide by the analog port value, etc. to get a pseudo-random number.
If its on a robot that only needs a random number with response to an external event (button pushed, sensor detects something, etc), then using the timer value would be best.
hazzer123:
Heres a tutorial with an idea for generating random numbers using the ADCs -
http://www.sparkfun.com/commerce/present.php?p=Sinister7
paulstreats:
most systems on modern computers still just use the timer. They use the nano seconds at the capture time as a root.....
Random numbers exist as just random, you have to take a reading randomly from somewhere. Take the reading from a timer in ms us or ns and divide by an a/d reading etc.....
Navigation
[0] Message Index
Go to full version