May I ask how to choose random prime number in fix interval?
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
loong seow li
il 28 Apr 2016
Commentato: loong seow li
il 28 Apr 2016
May I ask how to choose random prime number in fix interval? For example, choose prime number in between 2 to 30...
0 Commenti
Risposta accettata
Andrei Bobrov
il 28 Apr 2016
a = 2;
b = 30;
p = primes(b);
p = p(p >= a);
out = p(randperm(numel(p),1));
Più risposte (1)
Vedere anche
Categorie
Scopri di più su Elementary Math in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!