Hi Arash and Najib,
I investigated the issue we were discussing some more.
It appears that negative numbers in a selection variable’s “values” list get converted to positive numbers. I don’t yet see where or why this happens, but I’ll figure it out and let you know.
As for Arash’s original question (i.e. how to use a selection variable to draw randomly from a finite set of values), I’ve attached an example that demonstrates one way to do it. Here are the key points:
-
nsamples
is set to the number of values invalues
-
sampling_method
is “samples” - While the number of draws is less than the number of values, you do “Next Selection” after each draw. When the number of draws equals the number of values, you do “Reset Selections”.
This technique works equally well for random_with_replacement and random_without_replacement. (The example demonstrates random_without_replacement.)
There are probably other ways to do this, but this approach seems relatively straightforward to me.
Chris