How can I generate a random number in MATLAB between 13 and 20?
相关问题
- Extract matrix elements using a vector of column i
- Do the Java Integer and Double objects have unnece
- Unity - Get Random Color at Spawning
- How do I merge consecutive numbers in a sorted lis
- How do you get R's null and residual deviance
相关文章
- why 48 bit seed in util Random class?
- How do I append metadata to an image in Matlab?
- Need help generating discrete random numbers from
- How can I write-protect the Matlab language?
- `std::sin` is wrong in the last bit
- Escape sequence to display apostrophe in MATLAB
- Get random records with Doctrine
- Vertical line fit using polyfit
Best solution is
randint
, but this function produce integer numbers.You can use
rand
with rounding functionThis produces Real random number between a and b , size of output matrix is m*n
if you are looking to generate all the number within a specific rang randomly then you can try ` r = randi([a b],1,d)
a=start point b=end point d= how many number you want to generate but keep in mind that d should be less than or equal to b-a
You can also use:
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
Generate values from the uniform distribution on the interval [a, b].
If you are looking for Uniformly distributed pseudorandom integers use: