Random isn't random

aliz94aliz94 Member, PRO Posts: 19

I have an attribute change to random(1,2) and it determines what actor is spawned. The same pattern of actors appears each time. It goes 1,2,1,2,1,2,etc it never does for example 1,1,1,2,1,2,2 being really random.

Comments

  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598

    Hello @aliz94 How are you triggering the random change - with a Timer set to Every, for instance?

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • revoltandreverbrevoltandreverb Member Posts: 159

    What I usually do is make a attribute tester button as attached, just so you can see what's going on. What attribute type are you using?

    https://www.dropbox.com/sh/xq0dgrc9y4654qy/AAA3WrN1whhx8_PEPuvKP2e4a

  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    edited July 2014

    Testing the attribute is good, as @revoltandreverb suggests :smile:

    My question about the Timer set to Every concerns the fact that you wouldn't see anything other than 1,2,1,2 in a Display Text behaviour set to the single attribute showing the randoms.

    Because (the following explanation based on showing results via a Timer as described): say there were two or three "1"s in a row, it would still show as 1. When changing to 2, similarly, not seeming to change no matter how many repeats of 2, until a 1 is chosen again; and so on.

    So here's my test file as well to show you what I mean:

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

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

    @revoltandreverb said:
    What I usually do is make a attribute tester button as attached, just so you can see what's going on. What attribute type are you using?

    https://www.dropbox.com/sh/xq0dgrc9y4654qy/AAA3WrN1whhx8_PEPuvKP2e4a

    Works fine for me too . . .

    @gyroscope said:
    My question about the Timer set to Every concerns the fact that you wouldn't see anything other than 1,2,1,2 in a Display Text behaviour set to the single attribute showing the randoms . . .

    Although this is almost certainly not the issue it's worth pointing out, even if just for the maths pedants out there :smile: . . . aliz94's first example sequence 1, 2, 1, 2, 1, 2 is every bit as random as his second example sequence 1, 1, 1, 2, 1, 2 - both are as likely to be produced in a truly random system (both sequences have a 1/64 chance of occurring) . . . . and, counterintuitively, if you were to run the random sequence generator a thousand times and each time you got the same 1, 2, 1, 2, 1, 2 sequence then there is nothing about this result that should make you think the random sequence generator is not truly random - as the likelihood of 1, 2, 1, 2, 1, 2 turning up every time you run the random sequence generator is no less or no more than the likelihood of any other series of results.

  • aliz94aliz94 Member, PRO Posts: 19
    edited July 2014

    @gyroscope said:
    Hello aliz94 How are you triggering the random change - with a Timer set to Every, for instance?

    I am.

    Is there any way to make this work with every 0 seconds?

  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    edited July 2014

    Hi @aliz94

    @aliz94 said:
    Is there any way to make this work with every 0 seconds?

    sure it is - although the random numbers generated would be so fast not sure how useful it'd be visually nor, I suspect, would the resulting very fast stream of random 1's and 2's be much use for anything...

    (Unless you're "collecting them" for use somewhere in your game, but if you're wanting to do that, you'd put one of the few ways into your Rules to stop it generating after a set time so as to utilise the total output).

    Unless i'm missing something... what are you using these random series of 1's and 2's for, can I ask?

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • aliz94aliz94 Member, PRO Posts: 19

    @gyroscope said:
    Hi aliz94

    Unless i'm missing something... what are you using these random series of 1's and 2's for, can I ask?

    Can I ask how though? How would I make it change every 0 seconds and truly be random?

  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    edited July 2014

    Hi @aliz94 Try the following, easy to change:

    Download the test file I showed in the post above (if you haven't already), and simply change the Timer in the black square actor to Every 0 seconds. (then after you've seen what to do, apply that simple change to your own game file).

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

Sign In or Register to comment.