MathGroup Archive 1999

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

Search the Archive

Re: Biased Random[Integer]?


Here is an example that does it for p=1/3

<< Statistics`DiscreteDistributions`

In[2]:=
bd = BinomialDistribution[1, 1/3];
In[3]:=
Table[Random[bd], {12}]
Out[3]=
{0, 0, 0, 0, 1, 0, 0, 1, 1, 1, 0, 0}
--
Andrzej Kozlowski
Toyama International University
JAPAN
http://sigma.tuins.ac.jp
http://eri2.tuins.ac.jp



> -----Urspr=FCngliche Nachricht-----
> Von: AES <siegman at stanford.edu>
> An: mathgroup at smc.vnet.net <mathgroup at smc.vnet.net>
> Datum: Mittwoch, 4. August 1999 03:49
> Betreff: [mg19004] Biased Random[Integer]?
>
>
>>"Random[Integer]" gives 0 or 1 with .probability 1/2.
>>
>>What's the simplest expression that will yield 0 or 1 with probabilities
>>p  and  1-p ?
>>
>>(p itself might be a rational fraction, p = p1/p2.)
>>
>>I can write various expressions that do this, but what's the cleanest or
>>tersest way?
>>
>>
>
>


  • Prev by Date: Re: Showing a limited GrayLevel
  • Next by Date: Re: Biased Random[Integer]?
  • Previous by thread: Re: Biased Random[Integer]?
  • Next by thread: Re: Biased Random[Integer]?