Re: How to generate binary bit stream of length N with probablity of 0s and 1s
- From: roberson@xxxxxxxxxxxxxxxxxx (Walter Roberson)
- Date: Fri, 29 Feb 2008 17:34:35 +0000 (UTC)
In article <fq9f3i$s15$1@xxxxxxxxxxxxxxxxxx>,
Khurram Malik <malik_khurram@xxxxxxxxxxx> wrote:
Just wanted to know how can I generate a binary bit
sequence of 0s and 1s (lets suppose 1000 bits), with a
probablity Pr(x=0) = .3 and Pr(x=1) = .7
rand(1,1000) > 0.3
Converting the resulting logical array (of 0's and 1's) to a
"binary bit stream" is left as an exercise to the reader
(who will first have to figure out exactly what
a "binary bit stream" means to them.)
--
"Why does he stagger his mind with the mathematics of the sky?
Once the question mark has arisen in the human brain the answer must
be found, if it takes a hundred years. A thousand years."
-- Walter Reisch
.
- References:
- How to generate binary bit stream of length N with probablity of 0s and 1s
- From: Khurram Malik
- How to generate binary bit stream of length N with probablity of 0s and 1s
- Prev by Date: Re: uigetfile
- Next by Date: Re: running other applications
- Previous by thread: How to generate binary bit stream of length N with probablity of 0s and 1s
- Next by thread: Numerical Integrators
- Index(es):
Relevant Pages
|