Chose a random integer between an upper and lower limit.

I ask the user to input two limits a upper and lower limit. I then want to generate a random integer between these two values.
I tried using for example:
a = input('enter a'); %lower
b = input('enter b'); %upper
c = randi(b,a)
Although this seems to create a vector I just want a scalar?

 채택된 답변

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Random Number Generation에 대해 자세히 알아보기

제품

질문:

2014년 5월 1일

편집:

2014년 5월 1일

Community Treasure Hunt

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

Start Hunting!

Translated by