difference between rand n and randi
41 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
ali hassan
am 14 Okt. 2020
Bearbeitet: Ameer Hamza
am 14 Okt. 2020
hello everyone!
i am stuck on a short question.
can anyone tell me the difference between rand i and rand n?
x1 = randn(1,10000);
shiftVal = randi(5000,1);
what s difference between them?explain the output which will come
0 Kommentare
Akzeptierte Antwort
Ameer Hamza
am 14 Okt. 2020
Bearbeitet: Ameer Hamza
am 14 Okt. 2020
nandn() generates normally distributed random numbers with zero mean and unit variance. Read about normal distribution here: https://en.wikipedia.org/wiki/Normal_distribution.
x1 = randn(1,10000); % x1 is 1x10000
randi() only generates integers with uniform distribution. First input to randi() describe what is the maximum value of interger you want.
shiftVal = randi(5000,1); % output is 1x1
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Random Number Generation finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!