--- Laurence Mee wrote: > Actually, it's not that smart to use % for > such small values like that. > The least significant bits of the random > number are really not very random at all. > Instead you may want to use: > ((SysRandom(0) >> 8) % 15) + 1
I think this was covered in the previous thread about random numbers (circa Nov. 21), but who can remember that long ago? The start of this thread (back when it still had the 'R' in "Random", however, was from someone who had no idea how to get a "random" number. (Personally, I prefer throwing darts, and all such variations.) However, using SysRandom (which one would find immediately by searching for "random" in the docs) is probably what he was looking for. And, from his question, it seems that he did not know about the modulus operator, either. But that is a C question, not a Palm OS programming question. If you want a truly random number, i.e., a number chosen from a finite set such that any one choice has the same probability of selection as any other choice, you are really asking for something outside the realm of this forum. __________________________________________________ Do You Yahoo!? Check out Yahoo! Shopping and Yahoo! Auctions for all of your unique holiday gifts! Buy at http://shopping.yahoo.com or bid at http://auctions.yahoo.com -- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/tech/support/forums/
