piclist 2002\08\14\013050a >
Thread: Random sequence
picon face BY : Mike Singer email (remove spam text)

I would suggest:

How to get randomly-biased dice number.

1. Associate six 8-bit registers with six dice numbers.
2. Init them with 128 values.
3. On each loop subtract 5 from  that register which
  number was hit until it reached 0, of course.
  And add 1 to other registers until they reached 255.
4. Get 16-bit Sum of the registers.
5. Get random value from 0 to the Sum.("White noise"-Jinx
  is a Guru, "Black noise"-Roman is a Master ;-) :o)
6. Summarize register values until this sum reached
  previous "The Sum". Last register's number involved
  with this summarizing is the "randomly-biased dice
7. Go to "3."

No multiplication. No 32-bit calcs. "Numbers which had
been rolled less often" are of more probability to be hit.

Sorry, if someone has expressed the idea, I hadn't chance
of reading the thread: summertime seaside matters.

Brendan Moran wrote:
{Quote hidden}

http://www.piclist.com hint: To leave the PICList

<000001c24354$3e56e070$62c6fea9@crimea.com> 7bit

In reply to: <036301c242e6$48e00f30$199f42d8@czhang>
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 sequence

month overview.

new search...