How i can insert a random integer between two numbers?
이전 댓글 표시
I have a variable and i want it to take a randome integer between numbers 2 and 101
답변 (2개)
Thomas Koelen
2015년 4월 22일
편집: Thomas Koelen
2015년 4월 22일
a=uint16(2+rand*99)
Star Strider
2015년 4월 22일
The randi function is perfect for this:
rv = randi([2 101]);
카테고리
도움말 센터 및 File Exchange에서 Random Number Generation에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!