How to pick random number?
4 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hi, Please forgive me if I am asking a basic question. I want to pick random number from the set {2,3}. It should either pick 2 or 3 randomly. I have been looking at these functions called 'rand', 'randi', 'randperm' etc., but i couldn't figure out how to use them for my problem. Any help would be appreciated.
0 commentaires
Réponse acceptée
Azzi Abdelmalek
le 2 Oct 2013
Modifié(e) : Azzi Abdelmalek
le 2 Oct 2013
randi([2 3])
%or
v=[2 3];
v(randi(2))
3 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Spreadsheets dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!