| Author |
Comment/Response |
Xavier
|
06/28/08 03:35am
Hey,
I am currently using RandomSample to take a set of elements from a list. There seem to be a problem, or I missed something.
Consider this command:
Length[Union[RandomSample[Range[12]^341, 8]]]
This is expected to return 8, since we want a sample of 8 elements from a list of 12 elements. The result is fine.
Now, consider this command:
Length[Union[RandomSample[Join[Range[12]^341, {1, 1, 1}], 8]]]
I just add some other values, 1, which are really different from the other ones, and the result seems weird to me: if you evaluate 10 times this command, you can get "6", "7" or "8" ... though I would expect only "8" as a result.
Is it a problem of Mathematica or have I missed something ? Thanks for your help.
Cheers,
Xavier
URL: http://xroudaut.free.fr, |
|