To generate a random number between 0 and 50 in Matlab, you can use the randi
function with appropriate arguments. This function generates random integers within a specified range.
main.m10 chars2 lines
The above code generates a random integer between 1 and 50. If you want to generate a random number between 0 and 50 (inclusive), you can simply subtract 1 from the output of randi
.
main.m14 chars2 lines
This will give you a random number between 0 and 50 (inclusive).
gistlibby LogSnag