What is the difference between rand and randi when using it in a 3D array

 Réponse acceptée

KALYAN ACHARJYA
KALYAN ACHARJYA le 25 Août 2018
Modifié(e) : KALYAN ACHARJYA le 25 Août 2018
Its similar as usual, rand for uniformly distributed random number including floatings numbers, whereas randi for integers.

Plus de réponses (1)

Maybe try this:
array(randi([1 length(array)],1))

8 commentaires

madhan ravi
madhan ravi le 25 Août 2018
Modifié(e) : madhan ravi le 25 Août 2018
Doesn’t it work? You changed the question?
When dealing with 3D arrays if im looking to extract one random point what is the reason behind using randi?
randi produces random integer numbers and rand produces random floating numbers
randi was used here because the index of an array should be an integer.
Was my answer different?
Thank you bhai :)
Give a vote for my answer if you find it useful :)
Thanks it was useful.

Connectez-vous pour commenter.

Catégories

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by