X = randi([imin,imax],___) returns an array containing integers drawn from the discrete uniform distribution on the interval [imin,imax].
I would like to create a vector of random integers, call it Indx, of size 50. Assume I have a vector of integers, Min, and a vector of integers, Max, both of size 50. Also assume that the first value of the vector Min is less than that of the vector Max, the second value as well, and so on...
What I would like to get is:
Indx = randi([Min, Max],1,50) which goes over the first elements of Min and Max, takes a random integer between them, places it in the first cell in Indx, then it goes over the second elements of Min and Max, takes a random integer between them, places it in the second cell in Indx, and so on..
And I would like to do this without the use of a for loop. So basically using only 1-2 lines of code.
Is that possible?
Aucun commentaire:
Enregistrer un commentaire