creating pseudorandom number in PIC C
shwaip
bluffin' with my muffin Icrontian
I'm working on a project for a PIC 16F87, and I need a "random" number between (inclusive) 0 and 15. I've been looking for something on the internet, and I can't find anything that I really understand.
The randomness of the sequence serves no integral purpose, it's only for aestetics (displaying 1 of 16 messages), but I would like it to appear to be random. The PIC C compiler should be able to handle a regular C algorithm, but I really have almost no experience with PICC. Usually I write in assembly on the PIC.
Thanks.
The randomness of the sequence serves no integral purpose, it's only for aestetics (displaying 1 of 16 messages), but I would like it to appear to be random. The PIC C compiler should be able to handle a regular C algorithm, but I really have almost no experience with PICC. Usually I write in assembly on the PIC.
Thanks.
0
Comments
So in your case rand()%16 since you want 0 to 15.