It looks a little faster:
result = rand(m,n)<.5;
Or if you need a result like double :
result = double(rand(m,n)<.5);
Examples with m = 100 , n = 1e5 (Matlab 2010b):
>> tic, round(rand(m,n)); toc Elapsed time is 0.494488 seconds. >> tic, randi([0 1], m,n); toc Elapsed time is 0.565805 seconds. >> tic, rand(m,n)<.5; toc Elapsed time is 0.365703 seconds. >> tic, double(rand(m,n)<.5); toc Elapsed time is 0.445467 seconds.
source share