Using the Raised Cosine Distribution in PRNG
12-18-2016, 01:51 AM (This post was last modified: 12-18-2016 04:13 AM by Namir.)
Post: #1
 Namir Senior Member Posts: 949 Joined: Dec 2013
Using the Raised Cosine Distribution in PRNG
The Raised Cosine Distribution provides tool for a simple non-uniform PRNG. The equation for the cumulative probability function is:

CDF = [1 + xs + sin(pi*xs)/pi]/2

Where xs = (x-m)/s and m is the mean and s is the spread.

Choosing m = s = 0.5 makes the CDF curve map values from the range (0, 1) to values in the range (0, 1). This special mapping allows us to skip the traditional approach where we assign a uniform random number to CDF and solve for x (which requires using an iterative method). Instead we can cheat and use the above equation by assigning a uniform random number to x and calculate the CDF as the specialized random number. The distribution of the random number generated form a U shaped distribution. So to make your games interesting, test for values generated around 0.5 (say the range (0.45, 0.55)) to trigger game events. The recommended range is less likely to occur than values near 0 or 1.

I know that my suggestion is heretical, but it works!!

Namir
 « Next Oldest | Next Newest »

 Messages In This Thread Using the Raised Cosine Distribution in PRNG - Namir - 12-18-2016 01:51 AM RE: Using the Raised Cosine Distribution in PRNG - mark4flies - 12-21-2016, 01:42 PM RE: Using the Raised Cosine Distribution in PRNG - Namir - 12-21-2016, 03:20 PM RE: Using the Raised Cosine Distribution in PRNG - mark4flies - 12-25-2016, 12:30 PM RE: Using the Raised Cosine Distribution in PRNG - ttw - 12-26-2016, 01:37 AM RE: Using the Raised Cosine Distribution in PRNG - Paul Dale - 12-26-2016, 01:42 AM RE: Using the Raised Cosine Distribution in PRNG - Namir - 12-26-2016, 02:12 AM RE: Using the Raised Cosine Distribution in PRNG - Paul Dale - 12-26-2016, 07:39 AM RE: Using the Raised Cosine Distribution in PRNG - Namir - 12-26-2016, 11:03 AM RE: Using the Raised Cosine Distribution in PRNG - Dieter - 12-26-2016, 08:01 PM

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