Chronology Current Month Current Thread Current Date
[Year List] [Month List (current year)] [Date Index] [Thread Index] [Thread Prev] [Thread Next] [Date Prev] [Date Next]

Re: [Phys-L] From a Math Prof (physics BS major) at my institution ( math challenge)




On 2/26/2014 1:38 PM, Craig Wiegert wrote:
/snip/

I'm by no means proficient in matlab/octave, but it seems like all of
this choosing code could be replaced with calls to randperm(35, 5).

- Craig




p = randperm(n) returns a random permutation of the integers 1:n.
The randperm function calls rand. Here are two examples:

randperm(35)

ans = 33 26 18 5 4 1 23 6 14 25 7 32 9 15 13 2 12 29 22

28 8 16 30 34 10 17 21 24 31 20 11 35 27 19 3

randperm(5)

ans = 5 4 2 3 1


Brian Whatcott Altus OK