Algorithm for binary random generator

Status
Not open for further replies.

vinhpq

Newbie level 6
Joined
Sep 13, 2004
Messages
14
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
89
Binary random generator!

Hi, do you guys know a algorithm to genarate a binary output based on the input probability? I mean how the function randint, rand, randn in Matlab works.
 

Re: Binary random generator!

One approach is:

- approximate the needed probability "p(0)" with "n/(2^m)"
- define a binary function F of "m" binary variables as a table with exactly "n" rows at "0" (raws in random positions in the table)
- start "m" independent uniform (unbiased) binary generators g1, g2, ..., gm
- bit(t) = F(g1(t), g2(t), ..., gm(t))
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…