
MovieMaker
USA
Asked
— Edited
I can generate a random number between X and Y. That all works good. But, I need to repeatedly have a different random number each time that I run the subroutine. I find that when I run it, it gives me the same set of random numbers each time i run it. Like it draws out of the hat, but instead of being natural random, it is sort of fixed.
hope I am not asking too much. I hope you know what I am asking.
Thanks,
Mel
The command is GetRandom()
There are many random EZ-Script commands available to you
Like he is to choose 15 numbers randomly and then go back and randomly pick 15 more. he might choose #8 on numbers 1 to 15. But, EVERY single time I start the routine, he selects the number in the same order. He will choose #8 again. and again and again at the beginning of the generation. For the second number, he may choose #12 and he will choose #8 first and then #12 each time I run the routine. It is as if he is not changing the random number seed.
Instead of telling him like a servant or slave to do a specific task, I want to give him a set of tasks and let HIM choose what HE wants to do. This way, he has Free Agency.
Does that make sense?
There is sometimes confusion to people who do not understand what Random() means. There is an equal chance of returning the same number, a different number, the same pattern, or anything you can imagine within the specified range. Random means there is no predictable behaviour to the value being returned. For example, Chicken and Banana are two random words (to you). Pickle is another. Banana is another, so is Picture. And Pickle...
Test project: Testrandom.EZB
Frist run
Second run
If you want to let your robot "choose" (as you say) to do things, use the Personality Generator. You can control when it is active with ControlCommand PauseOn and PauseOff. Or, you can manually tell it to make a decision by using ControlCommand RunOnce. The personality generator is not "random", as it has a great deal of smarts within its decision process.
Further questions regarding random, i refer you to a philosophy forum
@MovieMaker, without seeing your code, I am guessing that you might be running into variables that retain their initial setting when your script "re-runs" the routine instead of having the variables cleared or reset with the GetRandom() command. Perhaps the GetRandom() command is misplaced in the loop or something?
Gunner, I will look into that. Thanks!
How about this: The fact that your results were not as expected proves that the results are random
I also think you may be confusing "unique" versus "random". Perhaps you wish random to produce a "unique" number each time it is executed. Perhaps you feel random should never return the same number? If you feel that way, that is not random - that is unique.
Perhaps what you would like to see is a UniqueRandom command to not return the same number as the last time it was executed?
It's always much easier to help if you understand the question you are asking