Without using randi inbuilt function

May i know,What is the source code of randi function and what are all the formulas that are associated with randi function.

 Respuesta aceptada

Walter Roberson
Walter Roberson el 30 de Abr. de 2022
Mathematically, the algorithm is
lower_bound + floor((upper_bound - lower_bound) * rand(size_to_generate))
Taking into account that rand() cannot generate exactly 0 or exactly 1.
This is not necessarily the MATLB implementation; the actual MATLAB implementation might try to compensate for the fact that binary does not map exactly onto factions.

Más respuestas (1)

Steven Lord
Steven Lord el 30 de Abr. de 2022

1 voto

We don't distribute the source code for the randi built-in function. If you want to see it, start here.

Categorías

Más información sobre Numerical Integration and Differential Equations en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 30 de Abr. de 2022

Respondida:

el 30 de Abr. de 2022

Community Treasure Hunt

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

Start Hunting!

Translated by