Borrar filtros
Borrar filtros

By what I can replace randint() function.

6 visualizaciones (últimos 30 días)
Karthik K
Karthik K el 20 de Sept. de 2018
Respondida: Steven Lord el 20 de Sept. de 2018
Here is a randint function, i am not having communication toolbox. How i can rewrite this statement. k = randint(1,1,10)+5;

Respuesta aceptada

Torsten
Torsten el 20 de Sept. de 2018
Editada: Torsten el 20 de Sept. de 2018
r = rand(1,1);
k = min(floor(10*r),9)+5

Más respuestas (1)

Steven Lord
Steven Lord el 20 de Sept. de 2018
The recommendation in the Release Notes is to use randi instead. The equivalent call is:
randi([5, 14], [1 1])
since randint(1, 1, 10) created a number in the range [0, 9].

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by