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
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에 대해 자세히 알아보기

질문:

2016년 8월 11일

답변:

2016년 8월 12일

Community Treasure Hunt

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

Start Hunting!

Translated by