How to generate random numbers 0 and 1
Mostra commenti meno recenti
I need to generate random numbers 0 and 1,if i use randi(1) it will be in fraction. exactly i need to generate 0 and 1 randomly???pls help
Risposta accettata
Più risposte (2)
Michael Haderlein
il 30 Gen 2015
e.g.
randi(2)-1
or
fix(rand*2)
Best regards,
Michael
3 Commenti
shruthi m
il 30 Gen 2015
Michael Haderlein
il 30 Gen 2015
randi(2,n,1)-1
or
fix(rand(n,1)*2)
Kamal yahya
il 27 Feb 2020
grid=fix(randi([0 1],100));
imtool(grid)
Nawaf Alharbi
il 10 Set 2018
1 voto
r=randi(2,n,1)-1
Categorie
Scopri di più su Creating and Concatenating Matrices in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!