Re: Biased Random[Integer]?

• To: mathgroup at smc.vnet.net
• Subject: [mg19110] Re: [mg19004] Biased Random[Integer]?
• From: "Andrzej Kozlowski" <andrzej at tuins.ac.jp>
• Date: Thu, 5 Aug 1999 01:35:25 -0400
• Sender: owner-wri-mathgroup at wolfram.com

```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]?