MathGroup Archive 2007

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: RandomChoice does not accept null weights


Jean-Marc Gulliet wrote:
> Szabolcs Horv=C3=A1t wrote:
> 
>>RandomChoice does not accept 0 weights.
>>
>>Is this the intended behaviour?
> 
> As far as I am aware of, the help page for RandomChoice does not state
> or imply that the weights must be positive. OTOH, the above error
> message clearly claims that the weight must be positive values. Shall we 
> 
> conclude that the documentation is again flawed or incomplete or
> misleading or ... (who knows what!) and that the behavior of
> RandomChoice is at it is by design?

It is strange that the documentation pages for RandomChoice and 
RandomSample don't seem to mention that the weights must be positive. I 
did however find this information here (in the section on Random Elements):

tutorial/RandomNumberGeneration

<<If the first argument to RandomChoice or RandomSample is a list, 
elements are selected with equal probability. The weight specification 
defines a distribution on the set of Subscript[e, i]s. The weights must 
be positive, but need not sum to 1.>>

It's a little baffling that they neglected to mention this on the pages 
for RandomChoice and RandomSample.


-- 
Helen Read
University of Vermont


  • Prev by Date: Can DSolve handle normalized vectors?
  • Next by Date: Re: Using FindRoot
  • Previous by thread: Re: RandomChoice does not accept null weights
  • Next by thread: Plotting Points with Labels