You would be familiar with retrieving a random value from the config by writing:
[Values] Randoms = 0 ~ 1999
And in code:
if (orxConfig_PushSection("Values")){ orxU32 value = orxConfig_GetU32("Randoms"); orxLOG ("Value: %d", value); orxConfig_PopSection(); }
This will give you a random number, eg:
Value: 1675
You can also define stepped random values using the following format:
[Values] Angles = 0 ~ 45 ~ 360
orxU32 value = orxConfig_GetU32("Angles");
Value: 270
In the example above, 0 ~ 45 ~ 360
would mean to define a range of values between 0 and 360, 45 steps apart.
Other examples would be:
0 ~ 1 ~ 10 (standard number range of 1 to 10, steps of 1) 0 ~ 1 ~ 1 (like a binary switch 0 or 1, same as 0 ~ 1) 1 ~ 5 ~ 100 (1 to 100 in steps of 5) 0 ~ 2 ~ 10 (an even number between 0 to 10)
You can also do this from code using any of the following functions:
orxMath_GetSteppedRandomFloat
orxMath_GetSteppedRandomU32
orxMath_GetSteppedRandomS32
orxMath_GetSteppedRandomU64
orxMath_GetSteppedRandomS64
An example:
orxFLOAT val = orxMath_GetSteppedRandomFloat(1, 100, 2.1); orxLOG ("Value: %f", val);
11.50000
So the above would be floats 1 to 100 in steps of 2.1. You can get more details about those functions here: http://orx-project.org/orx/doc/html/group__orx_math.html
A little tricker, but the same nonetheless:
[Values] MyRandomVector = (1, 3, 5) ~ (0, 0.1) ~ (2, 4, 6)
You can get more detail and examples in the Creation Template here or in your local repo of Orx.