Random Numbers

Recommended Posts

Originally Posted by 1veedo

I'm still not getting it. If you make a program

for (n=0; n < 11; n++)

out 10 * (sin(x));

then the output would vary each time?

No, the output would not vary each time. This code would generate an error because the value of x is not defined. The output depends only on the value of x. Using Int(sin(x)) adds nothing to a hoped for random output.

Share on other sites

If you have a deterministic algorithm that produces the numbers then they are not random

I actually wrote a termpaper on (pseudo)randomness not too long ago. All computer based algorithms are really deterministic, but the quality of a pseudorandom sequence generator differs from generator to generator. The formulae I mentioned above is called a Linear Congruential Generator, and is the one most used, e.g. in cryptography. If a and c is chosen as large numbers and m is a prime, then it will be difficult to guess what number that will be next, if you don't know a, c, m and X_0 (the seed). This is because the sequence will generate more numbers before it repeats itself.

Share on other sites

isn't there any series that can generate prime numbers.....if there is any such series, the series by itself would be a random number generator .... as prime numbers are random

random? not really, they are highly deterministically placed (look at the sieve or erastrothenes) and there is for instance always a prime in the interval [n,2n] (russel's postulate) and in particular the n'th prime is less than or equal to 2^n. something like that couldn't be true of a randomly chosen set of integers (where we'll take random to mean in some kind of asymptotic probabilistic sense, eg a genuinely random selection from the interval [0,M] would contain on average m/N numbers in any subset of size m) but they behave approximately randomly, indeed things that are true for 'random' numbers in some proper technical sense are true for the primes in particular. this could of course just be terminology.

second, there *is* a series the nth term of which is the nth prime, but there is no simple way to calculate this in an reasonable amount of time.

And for whomever asked, the digits of pi are conjectured to be *normal*, this cannot be proven.

And no there is nothing a priori random about the digits of ALL irrationals, indeed most (all?) we know about are either not normal or are only conjectured to be possibly normal. The digits of the first known transcendetal number (as in the first number known to be transcendetal) are very highly specified (something like sum over n of 10^{-n!})

http://mathworld.wolfram.com/NormalNumber.html

seems to indicate that the number of known normal numbers is practically zero, though there are uncountably many normal numbers, indeed the nonnormal numbers have measure zero i'm told.

Share on other sites


for (n=0; n < 11; n++)
cout<< 10 * ((int)sin(x));


A simple error in the code....it has to be modified as below

for(n=0; n<11;n++)
cout<<10 * ((int)sin(n))


Share on other sites

for(n=0; n<11;n++)

cout<<10 * ((int)sin(n))

This will always produce the same output whenever it's run.

Share on other sites

A random number generating algorithm fails as soon as a similar equation used is applied with the resulting value, that would mean softdragonz that your sine(x) generator would not be very useful whenever dealing with trigonometry. Delphi used: X[n+1]=134775813*X[n] + 1 (mod 2^32), which usuall works unless you use the returned value in some ways with the number 134775813.

Share on other sites

This will always produce the same output whenever it's run.

Yes....It generates random nos but the same set of random numbers are produced.....I didnt notice

Share on other sites

So there really is no such thing as random numbers?

If I were to throw some dice, they would land 'randomly', but there is a long complex physics equation that can determine how those dice got those numbers... and hypothetically one can substitute force values etc to make a desired outcome?

So basically my question is, how does the New York lottery generate its random numbers…?

Share on other sites

Yes....It generates random nos but the same set of random numbers are produced.....I didnt notice

You're using a deterministic algorithm to produce these numbers, therefore there is a pattern to them, therefore they are not random.

Share on other sites

So there really is no such thing as random numbers?

If I were to throw some dice' date=' they would land 'randomly', but there is a long complex physics equation that can determine how those dice got those numbers... and hypothetically one can substitute force values etc to make a desired outcome?

So basically my question is, how does the New York lottery generate its random numbers…?[/quote']

Yes that was what I was thinking, so surley as there seems to be so many patterns in nature, something like atomic decay could possibly have underlying order but as it is so inextricably complex we assume it is truley random.

Share on other sites

You're using a deterministic algorithm to produce these numbers, therefore there is a pattern to them, therefore they are not random..

Hmm....so it looks that though the numbers look random, they follow a pattern

Considering this, I was wondering that everything in nature has a pattern...

For instance, even when you throw a dice, the outcome is determined by a pattern that is a function of

- The speed with which you roll the dice

- The surface or surfaces (friction) on which the dice rolls

- Air resistance

There might be someother factors too....but definitely there is some pattern:-)

Share on other sites

Hmm....so it looks that though the numbers look random' date=' they follow a pattern

Considering this, I was wondering that everything in nature has a pattern...

For instance, even when you throw a dice, the outcome is determined by a pattern that is a function of

- The speed with which you roll the dice

- The surface or surfaces (friction) on which the dice rolls

- Air resistance

There might be someother factors too....but definitely there is some pattern:-)[/quote']

Some? Probably thousands if not more.

"God does not play dice."

I have heard of a half silvered mirror being popular for generating random numbers, measuring the number of photons penetrating vs reflecting.

Share on other sites

Try this on for size

Write down on a sheet of paper a set of random numbers from the top of your head. Are these numbers trully random, or is our brain using its own algorithims subconciously?

Also, even if you have a 6 sided dice, and make 50 throws for 50 numbers,

its still possible to crack the series, even though it would take extrordinary tools and the many variables affecting the roll, such as the angle of the throw.

Share on other sites

Write down on a sheet of paper a set of random numbers from the top of your head. Are these numbers trully random' date=' or is our brain using its own algorithims subconciously?

[/quote']

Hmm I suppose if you assumed the brain and thought process could be defined as inextricably complex orders, then that would contradict free will to an extent.

Share on other sites

No, the so called 'random' number is to the user of a program, but is actually an algorithm (there are millions of algorithms) that is given some input, and then obviously it gets an output.

I guess, though, that you could say that it's random to the user, but the programmer/coder has inserted some code, or written a formula to give the end-user the output of this 'random number'.

Steve

Share on other sites

I remember from a few years ago when I was learning VB that the Random function in VB gives you the same random numbers over and over again.

So the first random number would always be, say, 0.145 <-just an example.

And the second would always be something else. ALWAYS.

You have to use a Randomize command to randomize the random function .

Confusing...

Share on other sites

Suppose I put some balls in a bag with different colors.....and I pass the bag to my friend....who doesnt know what the bag contains.....

If he takes out a ball closing his eyes.....we can absolutely say that the ball that came out has a random color

Share on other sites

Suppose I put some balls in a bag with different colors.....and I pass the bag to my friend....who doesnt know what the bag contains.....

If he takes out a ball closing his eyes.....we can absolutely say that the ball that came out has a random color

Not entirely! There are some completely pure shades of colour that have to be teadiously prepared in a laboratory under very strict conditions such as an inert atmosphere or cold temperatures. I remember one particular article in newScientist about a year ago where the blackest black material had been made, about twenty times blacker than any other black previously constructed! Considering this I would say that your grubby fingers were likely to have made this impossible to achieve

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account