Post Reply 
A Random Question
06-09-2017, 03:15 PM
Post: #1
A Random Question
A common method for obtaining a pseudo-random number in RPL applications is to use something like the following.

Method 1: RAND <num> * CEIL

...where the integer <num> represents the largest value in the defined range of possible results (1..<num>). Assuming <num> is less than 10^11, an alternative method might be something like this:

Method 2: RAND MANT 1E11 * <num> MOD 1 +

The two methods will clearly give different results, but I'm wondering if the second approach reduces the quality of the randomization in any way. My inclination is to believe that the second method should be at least as good as (and possibly better than) the first, but I know better than to rely on a gut feel for this sort of thing. Are there problems with the second approach that would weaken the randomization when compared to the first? How could I test this?

I'm aware that the second method is very slightly slower than the first in a UserRPL context. The application I'm considering this for is a combination of SysRPL and Saturn code, though. In that context, the second method is about 40% faster. So I'd like to be able to use the second method as long as it doesn't compromise the result. I'm just not sure how to go about validating its effectiveness.
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
A Random Question - DavidM - 06-09-2017 03:15 PM
RE: A Random Question - pier4r - 06-09-2017, 03:46 PM
RE: A Random Question - Paul Dale - 06-09-2017, 11:37 PM
RE: A Random Question - Joe Horn - 06-10-2017, 12:03 AM
RE: A Random Question - DavidM - 06-10-2017, 01:45 AM
RE: A Random Question - pier4r - 06-10-2017, 08:55 AM
RE: A Random Question - DavidM - 06-10-2017, 05:10 PM
RE: A Random Question - Paul Dale - 06-10-2017, 05:18 AM
RE: A Random Question - John Keith - 06-10-2017, 12:57 PM
RE: A Random Question - pier4r - 06-10-2017, 01:20 PM
RE: A Random Question - DavidM - 06-10-2017, 03:51 PM
RE: A Random Question - Paul Dale - 06-10-2017, 11:49 PM
RE: A Random Question - DavidM - 06-11-2017, 01:11 AM
RE: A Random Question - Paul Dale - 06-11-2017, 05:04 AM
RE: A Random Question - lrdheat - 06-10-2017, 02:28 PM
RE: A Random Question - Paul Dale - 06-11-2017, 12:00 AM
RE: A Random Question - ttw - 06-11-2017, 12:21 AM
RE: A Random Question - DavidM - 06-11-2017, 01:39 AM
RE: A Random Question - Paul Dale - 06-11-2017, 05:19 AM
RE: A Random Question - ttw - 06-13-2017, 06:13 AM
RE: A Random Question - Paul Dale - 06-11-2017, 12:38 AM



User(s) browsing this thread: 2 Guest(s)