Post Reply 
A Random Question
06-10-2017, 05:18 AM
Post: #6
RE: A Random Question
Yes your actual approach is still biassed. To get an unbiased output you need to deal with the issue of the number of random values (here 10[sup]12[sup]) modulo the size of the integer you want (n in my code) is not zero. This is what my code attempted to do. This largest possible random value needs to be a multiple of the output range (n) and for larger random values, the process is repeated. i.e. repeat the process while the random number is greater than \( n \lfloor{\frac{10^{12}}{n}}\rfloor \). The bias involved isn't large per sample, but repeated lots and it will build up. A shuffle will repeat it lots.

I didn't remember exactly what MANT did, Joe is correct it is horrible.

If you've not picked an algorithm for the shuffle yet, use Fisher-Yates. This would be well suited to sys-RPL implementation. Deconstruct the list onto the stack, loop n-1 times swapping the chosen value with the nth stack level.

- Pauli
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: 1 Guest(s)