Re: RandomChoice does not accept null weights
- To: mathgroup at smc.vnet.net
- Subject: [mg83404] Re: RandomChoice does not accept null weights
- From: Szabolcs Horvát <szhorvat at gmail.com>
- Date: Mon, 19 Nov 2007 06:21:47 -0500 (EST)
Szabolcs Horvát wrote:
> ... or Pick[]ing out those elements whose
> weight is not 0 before passing them to RandomChoice[].
Pick[] caused a lot confusion here ... so some people may find the
following information useful.
Consider the this example:
In[1]:= Pick[{a, b, c}, {0, 1, 2}, Except[0]]
Out[1]= {a, b, c}
I expected the result {b, c}. So why is it {a, b, c}? Here is the
explanation:
http://groups.google.com/group/comp.soft-sys.math.mathematica/browse_thread/thread/b011242fd0f042a1/4930d9a0540d808f
IMO this example should be included under "possible issues" in Pick's
documentation.
Szabolcs--
Szabolcs