Interesting Challenge...

Hi,

So I think this formula, or a variant thereof, will be perfect. I can see why various values were selected but what is the logic behind the value 2836 - out of curiousity, why not something higher or lower?

This generator is based on so-called linear congurency - the most popular method to generate random numbers. I found it in one book about casino gambling (Casino Operations Management by J.Kilby, J. Fox) and then implemented in VBA, so I don't know the exact origin of the generator.
The core principle of random number generator is the Mod operation with high prime number - in that way random generators are similar to encryption tools.
 

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
Thanks very much! I tried your formula last night in a simulator and I couldn't detect a single repeating value in the first 685 million numbers. However, if I try to use other values (in place of the two factors for 2^31, including a high prime number) then I start getting repeats very early into the run.....I'm not sure why, or what is so significant about using 127773 that it yields such a high non-repeating sequence compared to other prime numbers.

Thanks again
Andrew
 

Forum statistics

Threads
1,222,723
Messages
6,167,853
Members
452,149
Latest member
gatje

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top