1. Pseudo Random Number Generators

How would i decipher the formula to a fixed seed PRNG?

I can manipulate the PRNG's Seed and Minimum and Maximum Values.

How would i use this to create a formula that mimics the PRNG's formula?

Thank you in advance for any help.

(I wasnt sure which forum to put this in but this forum said algorithms so i guessed it would fit here :P)

2. Do i need to explain my problem more? Is this even possible to find the formula to the prng?

I know there is a genius on these forums that can help me somewhere .
----------
Ok so the prng works like this, when i set the seed, it always picks from the top of a list (this list must be generated somehow).

So, i set the seed to 1.
I ask for a random number between 0-61.
Then i set the seed to 1 again.

I get the same number pairs. So its not using time or anything like that, literally just the seed number is the seed.

-----
So hopefully this will help - i will ask the PRNG for 3 numbers. (Remember if i set the seed again it will show those same 3 numbers).

I will ask the PRNG for a number between 0-61.

With a Seed of 0:
45
43
26

With a Seed of 1:
57
54
11

With a Seed of 2:
59
26
22

With a Seed of 3:
47
41
50

With a Seed of 4:
11
16
16
----------

These number when i set the corresponding seed number i get exactly the same results.

Is this possible to work out the PRNG formula? Do you think you ould do it if you had more data/results?

3. Are you looking for source code for a Pseudo Random Number Generator? If so, in which language? Do you need a particular distribution?

There is source code for many Pseudo Random Number Generators posted online. Usually, they output a number between 0 and 1, which you would have to scale for your desired range. You could also use tables to ensure you get the same three numbers all the same for the same seeds.

I need to work out the formula for a working PRNG.

I believe it to be a relatively simple PRNG, with tables as the numbers get repeated with the same seed.

Would this be possible to "Decode" a PRNG Formula? How would i go about solving this?

Thanks again
- uniflare

-edit: i will script the formula in php afterwards.

5. Originally Posted by uniflare

Do i need to explain my problem more? Is this even possible to find the formula to the prng?

I know there is a genius on these forums that can help me somewhere .
----------
Ok so the prng works like this, when i set the seed, it always picks from the top of a list (this list must be generated somehow).

So, i set the seed to 1.
I ask for a random number between 0-61.
Then i set the seed to 1 again.

I get the same number pairs. So its not using time or anything like that, literally just the seed number is the seed.

-----
So hopefully this will help - i will ask the PRNG for 3 numbers. (Remember if i set the seed again it will show those same 3 numbers).

I will ask the PRNG for a number between 0-61.

With a Seed of 0:
45
43
26

With a Seed of 1:
57
54
11

With a Seed of 2:
59
26
22

With a Seed of 3:
47
41
50

With a Seed of 4:
11
16
16
----------

These number when i set the corresponding seed number i get exactly the same results.

Is this possible to work out the PRNG formula? Do you think you ould do it if you had more data/results?

Why would you want to do this?

If you generate 1000000 numbers from a seed how long does the squence take to start repeating itself?

(from what you have written I see no reason why this has to be a "simple" prng)

RonL

6. Im doing it for a game+website

Ah interesting. with a seed of 0, the pattern does not seem to repeat itself - BUT after 8191 runs, it only outputs 0

so it stops generating numbers after it has generated 8191 numbers from the same seed.

Thanks for your help so far i appreciate it

7. Originally Posted by uniflare
Im doing it for a game+website

Ah interesting. with a seed of 0, the pattern does not seem to repeat itself - BUT after 8191 runs, it only outputs 0

so it stops generating numbers after it has generated 8191 numbers from the same seed.

Thanks for your help so far i appreciate it

RonL

8. ok i tested it with a lot of seeds it seems it can only generate 8191 random numbers until it stop producing them - with any seed.

Does this mean its picking numbers from a table that is 8191 numbers long? And using the seed to start from a seemingly random spot?

(Or am i way off? lol)

Thank you so much so far

9. Any chance you can get a copy of "Numerical Recipes. The Art of Numerical Computing"? There is a chapter there about random numbers, as well as sub-routine source code.

- - -

Alternately, "Numerical Methods and Software" also has a chapter about random numbers. In fact, one of the authors has source code for a FORTRAN routine posted on his website (called UNI):

Random Number Generator

If you know some FORTRAN, you should be able to translate it.

- - -

The NETLIB website is another source of good-quality source code:

NETLIB Website

If you do a search on the term "random", perhaps you will find source code for a program you can use. Again, most of these programs are in FORTRAN, so you will have to translate.

- - -

There is also the Mersenne Twister, a well-known algorithm with a very long period (in other words, it produces MANY numbers before starting to repeat itself). The Wikipedia page has some good background information, plus many external links that may interest you:

Wikipedia Mersenne Twister Page

For example, here is a link to a page with a C++ implementation of the algorithm:

Mersenne Twister C++ Code

(Of course, you could also do a Google search for the terms Mersenne and random, and you'd get thousands of other results.)

10. Originally Posted by uniflare
ok i tested it with a lot of seeds it seems it can only generate 8191 random numbers until it stop producing them - with any seed.

Does this mean its picking numbers from a table that is 8191 numbers long? And using the seed to start from a seemingly random spot?

(Or am i way off? lol)

Thank you so much so far
Are these 8191 numbers from each seed just a shifted copy of one another?

(Note $8191=2^{13}-1$, which is almost certainly significant)

RonL

11. Sorry david i fear you misunderstand, i dont want any old PRNG i want the one thats producing these results .

Ok so my tests indicate that that different seeds produce different lists, not shifted, they dont match at all.

I used an extremely simple scripting language called JASS to figure it out - if you want the code i used feel free to ask.

Thanks

12. Do you think its still possible? Would it help if i could get more information?

Thanks - uniflare

13. Originally Posted by uniflare
Do you think its still possible? Would it help if i could get more information?

Thanks - uniflare
I'm not prepared to do any more on this, if you want to carry it further read Knuth's "Seminumerical Algorithms" it's volume 2 of "The Art of Computer Programming", which deals with random number generators and their periods etc.

RonL

14. i dont blame you it seems like pretty heavy math.

Thanks for the help