Generate a random number in a certain range in MATLAB

前端 未结 9 1506
误落风尘
误落风尘 2020-11-28 10:08

How can I generate a random number in MATLAB between 13 and 20?

9条回答
  •  一个人的身影
    2020-11-28 10:53

    ocw.mit.edu is a great resource that has helped me a bunch. randi is the best option, but if your into number fun try using the floor function with rand to get what you want.

    I drew a number line and came up with

    floor(rand*8) + 13
    

提交回复
热议问题