开发者

Implement 'randi' using 'rand' in MATLAB

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜