Browse Source

Merge branch 'master' of marty.website:olivier/projet_optim_m2

espitau 8 years ago
parent
commit
9f2c2cd83a
2 changed files with 2 additions and 2 deletions
  1. BIN
      slides.pdf
  2. 2 2
      src/permutation.cpp

BIN
slides.pdf


+ 2 - 2
src/permutation.cpp

@@ -20,9 +20,9 @@ void permutation::transpose(int i, int j) {
 
 // TODO rapport : dire qu'on garde l'invariant pi[0] = 0
 void permutation::random() {
-  // Knuth shuffle
+  // Knuth Fisher Yates shuffle
   // there is a bias due to the use of rand()%_
-  for(int i = 1; i < size; i++)
+  for(int i = size-1; i > 1; i--)
     transpose(i, 1+rand()%i);
 }