Forum rules - please read before posting.

Variable "Set as Random" does not seem to produce really random results

Hey Chris,

there is something weird with the outcome of this action.

I am using this action seven times for seven global popup vars to create a random word consisting of seven characters; characters 1, 3, 5 and 7 are vowels, while 2, 4 and 6 are consonants, so the resulting word has a pattern of VCVCVCV (like "akesico" or "origame").

For this to work, the vowel vars can take 1 of 5 values (a,e,i,o,u) and the consonant vars 1 of 21 accordingly, but when I run the action in loop and watch the outcomes, there is no doubt that the lower values get "drawn" significantly more often than the higher ones. I made a screenshot video to "prove" it – if you watch it, you'll notice that a, b, c and e dominate while u, v, w, x, y, z practically never occur at all:

I am running the actions one by one in a background action list.

Now I assume that this is a unity-related problem and not AC, but maybe you have an idea what is going on under the hood.

Best, Jensen

Comments

  • OK, this is for real.

    I wrote another actionlist which simply

    • sets a Popup Var to a random value between 0 and 19
    • then increases a corresponding Counter (Int Var) by 1
    • and loops.

    The result can be seen here.

  • The Action indeed relies on Unity's own Random.Range function.

    AC doesn't set a seed, which - if I understand correctly - should cause the randomness to be affected by the system clock.

    Because it's using Unity's Random class, however, it does mean that it should react to changes in Unity's Random.seed value.

    Try running a custom script on startup to set the seed itself to a random value.

  • Thanks, Chris!

    I played around a bit and found the "Variable: Check Random Number" action to produce the results I need.

  • But I am curios: does the "Variable: Check Random Number" action work differently compared to "Variable: Set / Set as Random"? The results it creates seem actually to be evenly distributed …

  • No, that too uses Random.Range.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.