50g: an interesting RAND anomaly
|
03-18-2018, 04:08 PM
Post: #11
|
|||
|
|||
RE: 50g: an interesting RAND anomaly
(03-18-2018 03:44 AM)Thomas Okken Wrote: ... if you want a random integer between 0 and 3 inclusive, do RAND 4 * IP for maximum cycle length. Stay away from the least significant digits! The UserRPL sample was just intended to show the issue to a larger audience as opposed to being the final application. The application in question is actually in the form of a Saturn code object, whose purpose is to randomize a list. Performance is a key concern, so I'd like to stick with integer operations for this if possible. One alternative I'm considering: - Execute the internal RAND function - Convert the resulting seed from BCD to HEX - Split the 12-digit HEX seed into two halves and XOR them - MOD the result by the needed value (which will always be well within the limits of a 6-digit hex value) There would still be a bias toward the least significant digits, but in this case they would have also been XOR'd with the upper half of the seed. Does this present any obvious concerns? Initial testing from a speed standpoint is good, but that of course says nothing about efficacy. Note that the standard here is not DieHard(er) or NIST certification. I'm just looking for something that would be comparable in quality to "<num> RAND * IP 1 +". I've yet to find a reasonable way to test the results, though. |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 4 Guest(s)