Dear Community,
I tried to use, for example, RandomInteger, in Select as follows:
Block[{x = Range[0, 9], r},
r = RandomInteger[9];
{x, Select[x, # == RandomInteger[9] &], r, Select[x, # == r &]}
]
But the following is the output I obtained in one run:
{{0, 1, 2, 3, 4, 5, 6, 7, 8, 9}, {0, 7, 9}, 3, {3}}
Also, the output in the first Select could be a list of length 1, 2, or 3, different from one run to another. The second Select, however, always gives correct result. Similar problem was found for RandomReal.
Is a random number generator not allowed as part of the criterion? If not, what are the reasons?
Many thanks,
Chi-Hsiang