I'm trying to find a function that chooses from a specified list of values.
So you would put something like
into the expression editor and it randomly choose one of those values.Code:choose(16, -16, 0)
Is there a way to do this?
I'm trying to find a function that chooses from a specified list of values.
So you would put something like
into the expression editor and it randomly choose one of those values.Code:choose(16, -16, 0)
Is there a way to do this?
You can use an extension, such as Mersenne Twister Random Object, Random Pool, or Randomizer Object.
I'll check those out, thank you!
Where can I download the Mersenne Twister object? I can't seem to find a non-outdated download link.
This can be done natively in Fusion as well, if you desire. Use the Random Range function: RRandom(Min, Max). Make sure you use the two "R"'s, as the range feature doesn't work with the standard Random(val).
Using casleziro suggestion on your example,
if you only need the specific values you wrote down,
that would be:
16* RRandom(-1,1)
if you need a bigger/more varied list of elements,
you can use string tokenizer to split a string like 1|5|12|3|7|24
and then pick val(random(numberofelements)) (pseudocode!)
or a list object,
untick 1-based index in its properties
write down all your numbers in the list, one x line
and pick:
Val( List Line Text$( "List", Random(List Nb Lines( "List" )) ) )
(real code)
Right, I completely missed the point of the question and assumed Electriic meants a random number from within a range. Thanks, Schrodinger.