> Why not select their lower bits? Or in other words, select Random mod table_size Note that even this may affect your randomness of the max range of the random number is not a multipiler of your table size. For example, if your random number is in the range 0 to 15 and your table is 0 to 14 than the value '0' is more likly than let's say 7. Tal > -----Original Message----- > From: pic microcontroller discussion list > [mailto:PICLIST@MITVMA.MIT.EDU]On Behalf Of Mike Singer > Sent: Monday, July 22, 2002 10:14 PM > To: PICLIST@MITVMA.MIT.EDU > Subject: Re: [PIC]: Large random numbers > > > Jinx wrote: > . > . > > Picking > > random numbers for a small table takes longer, because so many > > Timer1L values are rejected for being too big for the high byte, and > > it can take a second or two to complete the full number but as long > > as it's as close to random as possible it's not too important. If the > > table size was set to 30,000d (7530h) for example then it would take > > a short time to find an acceptable high byte (00 - 75) but longer to > > find numbers less than 0x31 if the high byte is 0x75 > . > . > Hi, Jinx! > > You should prove that rejecting some values, you don't > hurt randomness. > Why do you reject them at all? > Why not select their lower bits? > > Mike. > > -- > http://www.piclist.com hint: The PICList is archived three different > ways. See http://www.piclist.com/#archives for details. > > -- http://www.piclist.com hint: The PICList is archived three different ways. See http://www.piclist.com/#archives for details.