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

 채택된 답변

Walter Roberson
Walter Roberson 2022년 4월 30일

0 개 추천

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.

추가 답변 (1개)

Steven Lord
Steven Lord 2022년 4월 30일

1 개 추천

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

카테고리

도움말 센터File Exchange에서 Numerical Integration and Differential Equations에 대해 자세히 알아보기

태그

질문:

2022년 4월 30일

답변:

2022년 4월 30일

Community Treasure Hunt

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

Start Hunting!

Translated by