Jun 8, 2011 #1 C chiu Newbie level 3 Joined Feb 19, 2010 Messages 4 Helped 0 Reputation 0 Reaction score 0 Trophy points 1,281 Activity points 1,316 how can i build a binary random generator in MATLAB and the output 0 and 1 with the same probability? could you please write the code for me? cuz im a very newbie thank you ---------- Post added at 21:39 ---------- Previous post was at 20:35 ---------- i come up with a way to build it i=1:100; b=rand(1:length(i)); b(b>0.5)=1; b(b<=0.5)=0; plot(b) do you think its good? OR do u have any other better way to build it? thanks
how can i build a binary random generator in MATLAB and the output 0 and 1 with the same probability? could you please write the code for me? cuz im a very newbie thank you ---------- Post added at 21:39 ---------- Previous post was at 20:35 ---------- i come up with a way to build it i=1:100; b=rand(1:length(i)); b(b>0.5)=1; b(b<=0.5)=0; plot(b) do you think its good? OR do u have any other better way to build it? thanks
Jun 8, 2011 #2 andre_luis Super Moderator Staff member Joined Nov 7, 2006 Messages 9,593 Helped 1,190 Reputation 2,399 Reaction score 1,207 Trophy points 1,403 Location Brazil Activity points 55,669 Probably you must to manage seed entry to avoid the function return same result always. +++
Jun 9, 2011 #3 alexan_e Administrator Joined Mar 16, 2008 Messages 11,888 Helped 2,021 Reputation 4,158 Reaction score 2,031 Trophy points 1,393 Location Greece Activity points 64,371 You can check https://www.edaboard.com/threads/210032/#post887210 Alex
Jun 9, 2011 #4 J jpanhalt Advanced Member level 3 Joined Jun 28, 2010 Messages 722 Helped 216 Reputation 442 Reaction score 217 Trophy points 1,323 Activity points 6,948 Don't 0 and 1 have the same probability with a 50% duty-cycle square wave? John
Jun 9, 2011 #5 bigdogguru Administrator Joined Mar 12, 2010 Messages 9,821 Helped 2,350 Reputation 4,694 Reaction score 2,272 Trophy points 1,413 Location Southwest, USA Activity points 62,383 The Quantum Random Bit Generator Service has a free QRBG Matlab Toolbox available: **broken link removed** **broken link removed**
The Quantum Random Bit Generator Service has a free QRBG Matlab Toolbox available: **broken link removed** **broken link removed**
Jun 10, 2011 #6 H hoz Junior Member level 3 Joined Dec 22, 2006 Messages 26 Helped 1 Reputation 2 Reaction score 1 Trophy points 1,283 Activity points 1,455 might help: rand('seed',11111111) N=100; round(rand(N,1))
Jun 10, 2011 #7 J jeevarajan.mk123 Newbie level 5 Joined Jan 13, 2010 Messages 8 Helped 0 Reputation 0 Reaction score 0 Trophy points 1,281 Activity points 1,311 w=randn(1,10); disp(w);