开发者

Implement 'randi' using 'rand' in MATLAB

开发者 https://www.devze.com 2023-03-28 21:48 出处:网络
To increase backward compatibility i want to replace all my \"randi([m,n])\" to some function that uses only rand, as people with e开发者_运维知识库arlier versions of MATLAB do not have randi function

To increase backward compatibility i want to replace all my "randi([m,n])" to some function that uses only rand, as people with e开发者_运维知识库arlier versions of MATLAB do not have randi function.


If you're talking about randi(imax,[m,n]), you could use something like:

ceil(imax*rand([m,n]))

If you mean randi([imin,imax]), refer to the link Amro provided in the comments: Using rand in matlab to produce numbers between limits

0

精彩评论

暂无评论...
验证码 换一张
取 消