Generate Random Sample between [0,1)

2 次查看(过去 30 天)
Hi guys,
how do I generate a uniformly distributed random numbers between [0,1)?
"rand" can only generate (0,1).
Thanks,
Jonathan

采纳的回答

Walter Roberson
Walter Roberson 2016-1-17
With N an integer between 1 and 53 (inclusive)
randi([0 2^N-1])/(2^N)
provided that randi is truly uniform random.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Random Number Generation 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by