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

 Respuesta aceptada

KALYAN ACHARJYA
KALYAN ACHARJYA el 25 de Ag. de 2018
Editada: KALYAN ACHARJYA el 25 de Ag. de 2018
Its similar as usual, rand for uniformly distributed random number including floatings numbers, whereas randi for integers.

Más respuestas (1)

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

8 comentarios

madhan ravi
madhan ravi el 25 de Ag. de 2018
Editada: madhan ravi el 25 de Ag. de 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.

Iniciar sesión para comentar.

Categorías

Más información sobre Creating and Concatenating Matrices en Centro de ayuda y File Exchange.

Preguntada:

el 25 de Ag. de 2018

Comentada:

el 18 de En. de 2023

Community Treasure Hunt

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

Start Hunting!

Translated by