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
That's how random works. There is nothing wrong with the random number command.
The command is GetRandom()
There are many random EZ-Script commands available to you
Let's say i want the robot to randomly do 15 things. I randomly start doing them. But, when I go back to the place where he is supposed to do a random thing, he chooses the same option every time.
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?
GetRandom() works as designed. GetRandom() generates a random number between the min and max value. More information about what a Random number is can be found here: http://en.wikipedia.org/wiki/Randomness
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
Heh Heh, My son uses the term "Random" to mean a strange thing happened... perhaps I need to start giving him philosophy lessons each time he says that That might get him to speak English instead of teenager
@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?
Well, I see it worked fine for you. It worked different for me. I must live in the Bermuda Triangle or twilight zone. ... Weird. sorry I wasted your time. But, thanks for letting me know.
Gunner, I will look into that. Thanks!
It doesn't work fine for me and different for you, it works as designed. Random means the returned value will be unpredictable. I can't explain that any differently What you "wanted" to happen isn't what happened because what happened was random. Does that make sense? I can't explain it any different...
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
Thank you, my friend for making that clear.