AMOSi:Zandom Number

From Amiga Coding
Revision as of 01:51, 17 November 2007 by Spellcoder (talk | contribs) (1 revision(s))
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Generates a random number from -32767 to 32768. The range of the numbers is set via a bit-mask, which is combined with the return value using a logical AND operation. It's easiest to enter the range as just less than an exact power of two, such as 31, 63, 127, or 255. This will provide you with random numbers from 0-31, 0-61, etc.


Let X=Z(255)

The reason for the odd name, is that we ran out of letters! If we`ve had the option, it would have been called R for random!