To randomly choose 3 values of a parameter l from the interval [1,6] in MATLAB, you can use the randi
function:
main.m23 chars2 lines
This will generate a row vector with 3 elements, where each element is a random integer between 1 and 6 inclusive.
You can also use the randperm
function to generate a random permutation of the numbers 1 to 6, and then take the first 3 elements:
main.m35 chars3 lines
This will generate a row vector perm
with a random permutation of the numbers 1 to 6, and then l
will be a new row vector containing the first 3 elements of perm
.
gistlibby LogSnag