piclist 2003\01\01\102653a >
Thread: Random from 0 to 7
www.piclist.com/techref/microchip/math/index.htm?key=random
picon face BY : Bob Ammerman email (remove spam text)



Here is a simple solution to the problem.....

Given a function

unsigned char PRNG(unsigned char limit)

that generates a pseudo-random number in the range 0..limit-1


val = PRNG(7);            // start with a pin in 0..7
for (;;)
{
   val = (val + 1 + PRNG(6)) & 7;
}


This works because each successive 'random' value can be any value except
the current one.

Bob Ammerman
RAm Systems




{Original Message removed}

seeking: microchip devices 16F
<002e01c2b1a9$f9576980$5800a8c0@DELL8100> 7bit

See also: www.piclist.com/techref/microchip/math/index.htm?key=random
Reply You must be a member of the piclist mailing list (not only a www.piclist.com member) to post to the piclist. This form requires JavaScript and a browser/email client that can handle form mailto: posts.
Subject (change) Random from 0 to 7

month overview.

new search...