Random number generation with two condition
显示 更早的评论
I want to generate two random number A and B.
Condition (1): A+B<=6
Condition (2): A-B<+=1
also A>0 and b>0
回答(1 个)
Image Analyst
2016-8-12
0 个投票
OK. Go for it. Let us know if you have a question.
Hint: Just use rand and repeat if the results don't meet your criteria. It shouldn't be too long before one pair of numbers meets your criteria.
类别
在 帮助中心 和 File Exchange 中查找有关 Random Number Generation 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!