MathGroup Archive 2007

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

Search the Archive

Re: RandomChoice does not accept null weights

  • To: mathgroup at
  • Subject: [mg83456] Re: RandomChoice does not accept null weights
  • From: Helen Read <hpr at>
  • Date: Wed, 21 Nov 2007 02:43:58 -0500 (EST)
  • References: <fhrs7v$5pe$> <fhu6o3$6q7$>
  • Reply-to: HPR <read at>

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):


<<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