Archived

This topic is now archived and is closed to further replies.

pi and randomness

This topic is 5828 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

a little while back i thought i saw a post where you could find out the nth digit (in hexidecimal) of pi without calculating all the (n-1) digits before it. this caught my eye as i thought that the digits of pi where random as far as we can tell and there are no patterns we can recognize. this being the case, that means that you could use the formula of finding the nth digit of pi and make a random number generator out of it that would have an infinite length since there are infinite digits of pi. since random number generators are quite useful in cryptography a random number generator with infinite length would be awesome. it makes sense to me, however i think im probably missing something somewhere in my logic. where did i go wrong? - jeremiah http://fakemind.com

Share this post


Link to post
Share on other sites
You''re referring to the David Bailey, Peter Borwein and Simon Plouffe algorithm. Here''s a good link for it:

http://www.mathsoft.com/asolve/plouffe/plouffe.html

Share this post


Link to post
Share on other sites
The term random in referring to pi is rather misleading. There is nothing in mathematics that I know of that says you cannot calculate the nth digit. pi can be represented by infinite decimal places. The 54th digit of pi will never change so I''m not sure what you mean by "random". Now there brings up the question of how do you choose which digit of pi to use as a random number generator. Are you going to randomly choose a digit of pi?

Share this post


Link to post
Share on other sites
I found the "formula"

float seed = some_number;
while(1)
{
seed += PI; //Duh..
seed *= seed; //Hmm...Raise by 2
seed -= int(seed); //Oh! Remove integers...
cout << seed << endl;
}

useful indeed...Seed = (0,1] or however you write it...0-1 excluding 1...

Share this post


Link to post
Share on other sites
The Bear: thanx for the link! very useful.

quote:
Original post by char_e
The term random in referring to pi is rather misleading. There is nothing in mathematics that I know of that says you cannot calculate the nth digit. pi can be represented by infinite decimal places. The 54th digit of pi will never change so I''m not sure what you mean by "random". Now there brings up the question of how do you choose which digit of pi to use as a random number generator. Are you going to randomly choose a digit of pi?



char_e: let me explain what i meant by "randomness" in pi better. randomness to the digits of pi mean that when you look at the digits starting with the "14159..." and on and on you wont see any patterns anywhere. for example, some decimal places start to repeat after a while. 1/3 repeats with an infinite number of 3''s. 1/6 begins with 1 but then repeats with an infinite number of 6''s. 1/7 turns out to be 0.142857142857142857... with the constant repeating pattern "142857". so when i refer to random, i simply mean that there are no recognizable patterns in the digits of pi.

how would one use the digits of pi as a random number generator? well, not necessarily the digits of pi, but if we have a formula for computing the digits of pi which are random, then shouldnt we be able to create other formulas that are similar that would "generate" random digits infinitely?

Tjoppen: im not entirely sure what that formula does, could you explain it for me?




now that ive been thinking about it, it takes more time to calculate the nth digit of pi as n gets bigger because then you start to deal with bigger and bigger numbers. usually random number generators can generate their next "random number" in the same amount of time as the previous. that being the case, i believe there are formulas that can calculate the digits of pi, but require calculating the previous n-1 digits first. it would still have a infinite set of random numbers and so couldnt we create similar formulas that could also generate infinite amount of random numbers that never repeats?

perhaps im wrong ( and i probably am ) but it seems to make sense. i guess as long as the formula to generate the digits of pi in order doesnt take longer to generate the next digit as n gets larger. off the top of my head i cant remember any of any formulas ive seen to do that though (to remember whether or not they take the same amount of time to generate the next digit as the previous).


 - jeremiah
 http://fakemind.com

Share this post


Link to post
Share on other sites
"...and there are no patterns we can recognize."

Decimal places 1 to 31: 1415926535897932384626433832795
Notice anything missing?

Decimal places 762 to 767: 999999

That''s not saying it''s not random, though. Random numbers will always have short-lived patterns in them. If there were no patterns, it wouldn''t be truly random.

As for the use as a random number generator, if you just want to break off from using rand(), you could use this instead...

Share this post


Link to post
Share on other sites
Reminds me of a dilbert cartoon, it went along the lines of:

A: "We''ve just purchased a brand new random number generator"
Generator: "3... 3... 3... 3... 3... 3......"
B: "It doesn''t look very random"
A: "That''s the thing with this stuff, you can''t really tell"



Well, since pi is an irrational number, it would seem to have random qualities to it. And for the game player, like they are really going to notice that the numbers in your game aren''t actually random and that they are clearly following the hexadecimal digits of pi.

Also, something doesn''t need to have an equal distribution to be called random, if you had a die with 6 sides where there are two 1''s, a 2, a 3, a 4 and a 5. It would still be considered random.

Trying is the first step towards failure.

Share this post


Link to post
Share on other sites