How to generate the random number with restrictions?
2 次查看(过去 30 天)
显示 更早的评论
采纳的回答
Guillaume
2016-1-7
编辑:Guillaume
2016-1-7
Your question is not very clear, what is a random number "as normal"?
Anyway, to get random numbers from a specific pool of numbers, generate random indices that you use to pick numbers from the pool:
pool = 1:4:25; %pool of numbers pick
numbers = pool(randi(numel(pool), 1, 28)) %choose 28 values from the pool at random.
0 个评论
更多回答(1 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Random Number Generation 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!