How random is the Random function?

2»

Comments

  • colandercolander Member Posts: 1,610

    @Socks
    You can have an algorithm, with a known seed, and not be able to predict the outcome just from knowing the seed and the algorithm, that is to say it would not be predictable, the only way to see what the results are is to run the algorithm - so although the algorithm might be deterministic in nature and have fixed (and known) values as its input the only way to see the result is to run the algorithm.

    Of course you will always have to do the calculations/run the algorithm or a copy of it to predict the result. If you and I have the same algorithm and inputs how would we not get the same result? The trick is to create one where so may inputs rely on realtime random events no one would have enough time to run a copy of your algorithm and take advantage of the result.

    If your number generator for the roulette wheel in your online casino does not produce random numbers often/fast enough and I have a copy of your algorithm and know your inputs I can predict your results and place my bet in a fraction of a second I can rob you blind. Even if it is the temperature on a mountain in some obscure place. That information would be obtained by the algorithm and if I know your algorithm I can run it and know the result just like you do and use it against you. The only way you can defend yourself is make sure I don't have the time to get my bet down or close betting then run your number generator with an external random input which is constantly changing in nature that I could not know before hand.

    @pHghost is right even pi is known and can be copied easily even events in nature. If I copy your algorithm and know where it goes to get inputs I can get them too. Time is the only defence for against it but in most cases that would be useless for example a software key or password which stay in existence and are not instantly used and obsolete.

  • The_Gamesalad_GuruThe_Gamesalad_Guru Member Posts: 9,922
    edited September 2014

    @Socks said:

    Iterations of Pi are a good example as regardless of how powerful a computer we could ever build, or even imagine, even a vast universal omnipotent computer that knew the energy state of every elemental particle that ever existed, knew where every quark and gluon was throughout the history of the universe, past, present and future - basically knew everything that was able to be known, that was knowable, then it would still not be able to predict the results of even a simple algorithm that iterates Pi,

    We call Him God ;)

  • ArmellineArmelline Member, PRO Posts: 5,334

    As @Socks says, your computer cannot create a truly random number.

    http://engineering.mit.edu/ask/can-computer-generate-truly-random-number

    But it really doesn't matter. None of us are going to need a truly random number in our GameSalad games.

  • pHghostpHghost London, UKMember Posts: 2,342

    @Armelline said:
    As Socks says, your computer cannot create a truly random number.

    http://engineering.mit.edu/ask/can-computer-generate-truly-random-number

    But it really doesn't matter. None of us are going to need a truly random number in our GameSalad games.

    @Socks is saying he thinks it can. I've been claiming it cannot.

  • ArmellineArmelline Member, PRO Posts: 5,334

    @pHghost said:
    Socks is saying he thinks it can. I've been claiming it cannot.

    Then I skimmed poorly :D

    A traditional computer simply cannot generate a truly random, unpredictable number. But for all intents and purposes...

  • pHghostpHghost London, UKMember Posts: 2,342
    edited September 2014

    @Armelline said:
    A traditional computer simply cannot generate a truly random, unpredictable number. But for all intents and purposes...

    In any case, this discussion has long moved just from the basic question, and took us to more remote (for a game engine forum) topics like randomness in nature vs. randomness in maths, irrational numbers and so on.

    I must say, it was a very enjoyable thread. ( -- @Socks & @colander primarily)

    To add a link to @Armelline‌'s, this is an interesting article about the history of random.org, which can generate truly random numbers for you, since they rely on their own hardware and data collection in the form of atmospheric noise: http://www.random.org/history/

    This shows it is easier and cheaper to create a true random number generator than I thought, but it is necessary to have a hardware component to collect unique data.

    Of course, with the random function in GS, since it does not obtain any random external data (as in not native to the device it runs on), the numbers you will get through it are not truly random.

  • AdrenalineAdrenaline Member Posts: 523

    As @Socks‌ said, I believe it all comes down to how we define "random". If you believe it means "unpredictable", then you can argue one way; if you believe it means "unique", then you can argue another way.

    I believe that there is no such thing as true random anywhere. Not in a computer, not in nature. As far as practical applications are concerned, then we can find random in MANY places. If no one can confidently predict the next number coming out of a random number generator, it's done its job very well.

    But as someone who's grown up being told random meant something like "without reasonable cause and therefore completely unpredictable", then I argue that we only BELIEVE we've found random because our understanding of a particular process is very limited.

  • AdrenalineAdrenaline Member Posts: 523

    thanks to @pHghost‌ for the link to randomness. The bottom of this page (http://www.random.org/randomness/) said it better than I could have ever hoped to. Call me a determinist :)

  • SocksSocks London, UK.Member Posts: 12,822
    edited September 2014

    @Armelline said:
    As Socks says, your computer cannot create a truly random number.

    @pHghost said:
    Socks is saying he thinks it can. I've been claiming it cannot.

    Yeah, like pHghost says, I am kind of arguing the other way, although not specifically a computer, we've gone waaaaay beyond that, we are currently in the esoteric epistemological backwaters of hypothetical maths and Swedish weather patterns : )

    Although no one's forwarded a solid definition of 'random', my idea is that you can create an algorithm that would produce output that would meet any reasonable definition of 'random'.

  • SocksSocks London, UK.Member Posts: 12,822
    edited September 2014

    @pHghost said:
    Yes, when I said that for a computer, if it was aware of the seed input and algorithm, the result would be 100% predictable, I meant it would be able to predict it because it would itself run the algorithm, knowing it.

    But - at least as far as I can see - running an algorithm is not synonymous with prediction, going back to Pi, we know the algorithm, and we can run the algorithm, but we are unable to predict (in any meaningful use of the word) what it will do, what results it will produce.

    I'm also a little unsure about mixing up the words 'run' and 'knowing it' (future and present tenses) . . . ("it would itself run the algorithm, knowing it").

    If you need to run an algorithm to 'know it', then you don't know it before you run the algorithm, and if you don't know the results before you run the algorithm then I can't see how you could say the results are predictable ?

    @pHghost said:
    I think you contradict yourself here a little bit. The reason what you are saying would work with π (or any other irrational number), is only because, and if, the number doesn't terminate. That is, you actually do not know the starting state.

    The starting state is the algorithm that iterates Pi, we know it !

    @pHghost said:
    Once you reduce π to a terminated, finite string of numbers, thus making it known, at exactly the same moment you are back at square one and the result is predictable by a computer

    Sure, but that's an entirely arbitrary move, that's like stopping any process to get the result you want, count up from the number 1 in whole numbers and you'll find you can arrive at any value you want - if you terminate this otherwise infinite sequence at 9,000,007 you can say the sequence ends at 9,000,007 . . . . but of course it doesn't it continues on forever, like Pi.

  • SocksSocks London, UK.Member Posts: 12,822
    edited September 2014

    @colander said:
    Of course you will always have to do the calculations/run the algorithm or a copy of it to predict the result.

    Not at all ! :smile:

    There are an infinite number of algorithms (literally infinite) that do not need to be run to know the result, where the results are entirely predictable.

    @colander said:
    If you and I have the same algorithm and inputs how would we not get the same result?

    We would always get the same result.

    @colander said:
    The trick is to create one where so may inputs rely on realtime random events no one would have enough time to run a copy of your algorithm and take advantage of the result.

    I'm not entirely sure that realtime events are random, difficult to predict certainly.

    @colander said:
    @pHghost is right even pi is known and can be copied easily even events in nature.

    If you are sure that Pi is known then you have just won yourself the Fields Medal ! lol !! : ) You just need to submit your proof.

    But seriously, Pi is an irrational number, it's exact sequence is not only unknown, but is actually unknowable, we have a continually improving focus on it, but by definition we can never know it. Once you've worked out the first 6,993,834 trillion, trillion, trillion, trillion trillion, billion, trillion digits, and you have all these results and you know the algorithm that produces that sequence of digits, you are still unable to predict any further digits from that information, and even with this vast volume of results you've not even calculated the first 0.00000000000000001% of the first 0.00000000000000001% of Pi . . . even if the process of iterating Pi went on infinitely, you will still never even calculate a billionth of one percent of Pi.

  • SocksSocks London, UK.Member Posts: 12,822
    edited September 2014

    @pHghost said:
    As Socks‌ said, I believe it all comes down to how we define "random". If you believe it means "unpredictable", then you can argue one way; if you believe it means "unique", then you can argue another way.

    Agreed, there are probably several definitions floating about here, that's why I've tried to reduce my use of 'random' in any argument down to "any reasonable definition of 'random'".

    @pHghost said:
    I believe that there is no such thing as true random anywhere. Not in a computer, not in nature.

    I can't say for sure where I stand, my instinct (whatever use that is) says there is unlikely to be true randomness in nature ?

    @pHghost said:
    As far as practical applications are concerned, then we can find random in MANY places. If no one can confidently predict the next number coming out of a random number generator, it's done its job very well.

    2

    @pHghost said:
    But as someone who's grown up being told random meant something like "without reasonable cause and therefore completely unpredictable", then I argue that we only BELIEVE we've found random because our understanding of a particular process is very limited.

    Like you say, definitions are important here, my loose definition of random is something that is not able to be predicted, not just that our predictions are limited by technicalities (we've haven't got a fast enough computer, we can't sample the wind patterns accurately enough and so on . . . ), but something that is, by definition, impossible to predict.

  • colandercolander Member Posts: 1,610
    edited September 2014

    @Socks
    Not at all ! :smile:

    There are an infinite number of algorithms (literally infinite) that do not need to be run to know the result, where the results are entirely predictable.

    Yes you do even if it is in your head you still need to do the calculations even for the real simple stuff like 1+1=2.

    I'm not entirely sure that realtime events are random, difficult to predict certainly.

    Agreed but you would need unimaginable computer power to predict the exact wind speed at a point on the Swedish coast at any given point in time. It wouldn't matter anyway because my copy of your algorithm would get the same information.

    If you are sure that Pi is known then you have just won yourself the Fields Medal ! lol !! : ) You just need to submit your proof.

    >

    But seriously, Pi is an irrational number, it is not only not know, but impossible to know, we have a continually improving focus on it, but by definition we can never know it.

    I am no mathematician, I can crack an egg but not pi :). But I don't need to know pi I just need a copy of your algorithm to get the same result you will. Doesn't my exact copy of your algorithm knows what your algorithm is doing with pi? Are the first 100 decimal places known, are the first 1,000,000 known, how couldn't my copy of your algorithm not drill down to what ever level of pi your algorithm is set to go to? It is an exact copy it will do exactly what yours does, pi or no pi, Swedish weather patterns or no Swedish weather patterns.

    This would bore the hell out of a lot of people but I am enjoying it :).

  • AdrenalineAdrenaline Member Posts: 523

    @Socks‌ you quoted @pHghost‌ a bunch but it looks like they were my quotes :)

    I think we're all mostly on the same page with all of this EXCEPT you seem to view "predictable" as requiring no calculations at all? If I need to run an algorithm to tell the next number in a sequence, I would certainly still call that predictable. But I'm guessing you'd say that's what makes it unpredictable? I find that to be an interesting viewpoint.

  • AdrenalineAdrenaline Member Posts: 523

    @colander said:
    This would bore the hell out of a lot of people but I am enjoying it :).

    +1!

  • SocksSocks London, UK.Member Posts: 12,822
    edited September 2014

    @colander said:
    ("There are an infinite number of algorithms (literally infinite) that do not need to be run to know the result, where the results are entirely predictable") . . . . . Yes you do even if it is in your head you still need to do the calculations even for the real simple stuff like 1+1=2.

    Here is an algorithm that does't need to be calculated to know the result:

    N * 0 = ?

    There an infinite amount of other algorithms that don't need to be calculated to know the result.

    @colander said:
    I am no mathematician, I can crack an egg but not pi :). But I don't need to know pi I just need a copy of your algorithm to get the same result you will.

    You will get the same result, certainly, but the result won't be able to be predicted.

    Saying 'I will get the same as someone else with the same algorithm' is not a prediction. We want numbers ! :smile:

    @colander said:
    Doesn't my exact copy of your algorithm knows what your algorithm is doing with pi?

    Yes.

    @colander said:
    Are the first 100 decimal places known . . .

    Yes.

    @colander said:
    are the first 1,000,000 known . . .

    Yes.

    @colander said:
    how couldn't my copy of your algorithm not drill down to what ever level of pi your algorithm is set to go to?

    Two algorithms with the same starting state will produce identical results.

    @colander said:
    It is an exact copy it will do exactly what yours does . . .

    Yes, agreed, the algorithm, regardless of who runs it, how it is run, or when it is run, will produce an infinite string of numbers that are only known through the process of executing the algorithm - that is to say the results are unpredictable, we are unable to know the outcome.

  • SocksSocks London, UK.Member Posts: 12,822

    @Adrenaline said:
    Socks‌ you quoted pHghost‌ a bunch but it looks like they were my quotes :)

    Whoops ! Not sure what's going on there.

    @Adrenaline said:
    I think we're all mostly on the same page with all of this EXCEPT you seem to view "predictable" as requiring no calculations at all?

    What do you mean by 'predictable' ?

  • pHghostpHghost London, UKMember Posts: 2,342

    @Socks said:
    You will get the same result, certainly, but the result won't be able to be predicted.

    OK, if we are still even remotely discussing computers -- when you say predict with a computer, you always mean it calculates it. In that sense, computers can predict thing, as in give you the number. Say, there is a computer churning out winning lottery numbers and you have the algorithm and all its data inputs. If you build a faster computer, it will 'predict' what the slower one will churn out, and you will be able to submit your lottery numbers and win.

    If we are talking outside computers, I agree with most of what you say. Of course you always need to calculate something to predict it, even 1+1 (well, that one can be said we've probably coded into our brains so deep you actually don't need to do the calculation). You cannot predict numbers by the numbers just popping into your head.

    Of course you cannot predict anything infinite. Just because it is infinite.

    I personally do believe that a lot of things in nature happen at random. That is without a logical reason. Most random mutations are simply mistakes a the level of copying DNA. It's an accident.

    The movement of air as well. Say you have a bird fly through an orchard. Its flight will move some air which will rustle a couple of leaves. The bird flew through in a specific way and could have flown through a near-infinite amount of other ways. For the bird itself, there was a purpose to how if flew, at that low level it made sense. But at a higher level, of our planet, there was no specific purpose for the bird having to fly that way. In the context of the planet, its flight, the pattern of its movements was random.

  • SnapFireStudiosSnapFireStudios Member Posts: 1,603

    Looks pretty random, or at least as random as you can have for anything.

    -- Thomas

  • colandercolander Member Posts: 1,610

    @Socks
    Here is an algorithm that does't need to be calculated to know the result:

    >

    N * 0 = ?

    You, me or a computer still needs to read/run an algorithm to know/calculate the result. An algorithm is a set of rules for solving a problem in a finite number of steps. By the way N * 0 = 0 :).

    Yes, agreed, the algorithm, regardless of who runs it, how it is run, or when it is run, will produce an infinite string of numbers that are only known through the process of executing the algorithm - that is to say the results are unpredictable, we are unable to know the outcome.

    If my computer processor is faster than yours I could beat you by a fraction of a second and therefore predict your result. Can I predict the result of my algorithm you ask? Well yes I buy/invent a faster computer and predict my own result, rinse and repeat to the end of time :). Seriously though when I talk about prediction in this thread I mean predicting your result not the result of the algorithm without running it that would be impossible. 1+1=2 is an algorithm which needs to be calculated. Thinking of 2 in a vacuum is not an algorithm it is just 2.

  • AdrenalineAdrenaline Member Posts: 523

    @Socks said: What do you mean by 'predictable' ?

    First, my definition of random :). The idea of true random seems unattainable to me. True random is something that happens without reasonable cause. "Without reasonable cause" is the only way anything can be unpredictable. We simply need to decipher the reasonable cause to something, and it then becomes predictable in future cases.

    I do not believe that anything can possibly happen without reasonable cause, therefore nothing can be UNpredictable. If it's not UNpredictable, it's not random :)

    There are some processes that we now assume are truly random, or at least we call them random because at this point it's pretty much the same thing. However, I think it's only a matter or time and knowledge before we redefine these. Long ago, we viewed very simple processes as being random (or even the acts of gods). Now, we understand the reasonable causes for these processes and the mystery (and randomness) has faded.

    By unpredictable, I literally mean NOT ABLE to be predicted. Ever. Imagine a perfectly smooth egg shell. At this moment it is solid, smooth, uncracked. Does that make it uncrackable? I view "unpredictable" and "random" in the same light.

    To speak practically, I might as well play devil's advocate. As far as A LOT of things are concerned, we can greatly simplify our pursuit of random and just settle on an algorithm that is too complicated for anyone to decipher in a reasonable amount of time. If the end results appear to distribute evenly and without pattern, well then hell…it's random enough!

    Let me end with one more thought: often, even distributions are the result of someone attempting to simulate randomness. Consider the selection of victims around a criminal's neighborhood. He may try to spread out his crime scenes in the hopes of leaving the detectives completely clueless, but all they have to do is investigate a point right in the middle and he'll most likely be hiding right there. Maybe, a more random distribution would have resulted in crimes densely packed in one area and lighted sprinkled in others. But anyone looking at that map would certainly argue against the randomness there!

Sign In or Register to comment.