The following warnings occurred:
Warning [2] count(): Parameter must be an array or an object that implements Countable - Line: 795 - File: showthread.php PHP 7.4.33 (FreeBSD)
File Line Function
/showthread.php 795 errorHandler->error





Post Reply 
New algorithm for random number generation
05-26-2014, 01:04 AM (This post was last modified: 05-26-2014 06:56 PM by Namir.)
Post: #1
New algorithm for random number generation
I have been tinkering with a set of new algorithms for uniformly-distributed random number generation (RNG). I test each algorithm using several long runs. I test various statistics related to each run of 10000 numbers (such as auto-correlation and various histograms). I end up calculator an empirical "goodness" factor based on these statistics.

Recently I bumped into an interesting algorithm while working with a family of RNGs that use ratios of random numbers generated using simpler/basic methods. I noticed the following:

Code:

1. Generate r1 (between 0 and 1) using basic RNG algorithm #1
2. Generate r2 (between 0 and 1) using basic RNG algorithm #2
3. Calculate R -= r1/r2
4. If R > 1 then R = 1/R
5. If R = 1 then R = 0
6. Return R as a random number

I noticed that the above algorithm often generates better random number than the underlying basic RNG algorithms.

I will publish (on my web site) my tinkering in a few week.

Namir

PS: You have some flexibility in choosing the basic algorithms in steps 1 and 2.
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
New algorithm for random number generation - Namir - 05-26-2014 01:04 AM



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