The Random Number Generator Interface Asset allows you to generate a random number located between defined minimum and maximum values. The Step property gives you more control over the precision of values you want to generate.
- Minimum: the lower bound of the range for the generated value.
- Maximum: the upper bound of the range for the generated value.
- Step: the step between 2 possible values
- Generated value: the value randomly generated. Only visible in the bindings panel, since it is a read-only property.
Example with Minimum = 0 & Maximum = 100
- Step = 1, the possible values will be 0,1,2,3,....,97,98,99,100
- Step = 10, the possible values will be 0,10,20,30,...,80,90,100
- Step = 0.5, the possible values will be 0,0.5,1,1.5,2,.....,99,99.5,100
- Number Changed: raised when the generated value has changed
Those conditional triggers will be raised when the variable value has changed and the condition is true.
- Number equals...
- Number greater than or equal...
- Number greater than...
- Number less than or equal...
- Number less than...
- Number does not equal...
- Generate Number: generates a new number within the specified range.
- Put all your items in a Flip Chart collection. Use of the Flip Chart ensures only one item can be seen at a time.
- Add a Random Number Generator interface asset to your experience.
- Bind the Index in focus property of the Flip Chart to the Generated value of your Random Number Generator IA
- Call the IA's Generate number action, linked either to a trigger like a button or use of a timer.
- Add two Random Number Generator interface assets to your experience, one to hold the x-coordinate value and the other for for the y-coordinate.
- For a FullHD display, respectively set their bounds to [0 - 1920] and [0 - 1080]. You can narrow those bounds to avoid moving assets onto or off the edge of the screen. The values depends on your screen resolution and the size of the assets. See this article for more information about positioning items in a scene.
- Call the Generate number action for both of your Random Number Generator IAs.
- Call the Move to action on your asset and bind that action's X & Y parameters to the generated value of the appropriate Random Number Generator IA.
- You can optionally add a third Random Number Generator IA to represent orientation (i.e. rotation).