From: Ruben on 8 Mar 2010 23:54 Hi, I would like to create a random number sequence that consists of 12 numbers. Which method can I use best: randperm(12) or randsample(12,12)? Ruben
From: Walter Roberson on 9 Mar 2010 10:29 Ruben wrote: > I would like to create a random number sequence that consists of 12 numbers. With or without replacement? Are the numbers to be integers? Chosen from 1:12 ?
From: Ruben on 9 Mar 2010 05:33 Thanks for reply. The 12 numbers have to be different integers chosen from 1:12 (so each number from 1 to 12 is used once).What is the best method in matlab to generate these 12 numbers in a random way? Thanks for help! Ruben
From: Walter Roberson on 9 Mar 2010 15:58 Ruben wrote: > The 12 numbers have to be different integers chosen from 1:12 (so each number from 1 to 12 is used once).What is the best method in matlab to generate these 12 numbers in a random way? Thanks for help! randperm(12) is of order N*log(N) and a guarantee of a finite run time. Any routine that uses selection "with replacement" and compares against the answers already selected has an infinite tail on the run time.
From: Ruben on 9 Mar 2010 07:40 Thanks for reply! I will use randperm(12). I don't exactly understand what you mean with 'is of order N*log(N)', could you explain it? Would be great. Thanks in advance! Ruben
|
Next
|
Last
Pages: 1 2 3 Prev: Simulink and ModelSim automation Next: Skewed GED Random Number Generator |