nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1diff --git a/svm.cpp b/svm.cpp
2index 3b7643e..2a34b42 100644
3--- a/svm.cpp
4+++ b/svm.cpp
5@@ -10,6 +10,7 @@
6 #include <vector>
7 #include <cmath>
8 #include <algorithm>
9+#include <random>
10 #include "feature.h"
11
12 namespace zinnia {
13@@ -43,11 +44,13 @@ bool svm_train(size_t l,
14 }
15 }
16
17+ std::random_device rand_device;
18+ std::default_random_engine rand_engine(rand_device());
19 static const size_t kMaxIteration = 2000;
20 for (size_t iter = 0; iter < kMaxIteration; ++iter) {
21 double PGmax_new = -kINF;
22 double PGmin_new = kINF;
23- std::random_shuffle(index.begin(), index.begin() + active_size);
24+ std::shuffle(index.begin(), index.begin() + active_size, rand_engine);
25
26 for (size_t s = 0; s < active_size; ++s) {
27 const size_t i = index[s];