Re: How to generate binary bit stream of length N with probablity of 0s and 1s



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
.



Relevant Pages

  • Re: You know your dog had a good weekend when...
    ... minutes on the agility course in the backyard is nothing to be sneezed ... people seem to think it's "I don't have time for a ton of exercise, ... I always think I should be doing more with my dogs to keep them entertained ... If I take them down to the stream, ...
    (rec.pets.dogs.behavior)
  • Re: You know your dog had a good weekend when...
    ... For example, if I take the dogs to the park for a hour, I ... If I take them down to the stream, ... While all dogs need and enjoy exercise, I think one of the joys of having ... & Queenie the black gold retriever ...
    (rec.pets.dogs.behavior)
  • Re: You know your dog had a good weekend when...
    ... For example, if I take the dogs to the park for a hour, I ... If I take them down to the stream, ... While all dogs need and enjoy exercise, I think one of the joys of having ... exercise dogs in the larger variety, especially when there's more than one. ...
    (rec.pets.dogs.behavior)
  • Re: Read macro for one of two ideas
    ... If we had an overscore character then only underscores and overscores ... breaking somehow or working differently when your (, reader is present? ... the character that was read from the stream). ... (defun paren-close-reader (stream char) ...
    (comp.lang.lisp)
  • Re: Read macro for one of two ideas
    ... If we had an overscore character then only underscores and overscores ... breaking somehow or working differently when your (, reader is present? ... the character that was read from the stream). ... (defun paren-close-reader (stream char) ...
    (comp.lang.lisp)