Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/moses-smt/mosesdecoder.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbhaddow <bhaddow@1f5c12ca-751b-0410-a591-d2e778427230>2009-02-12 15:58:27 +0300
committerbhaddow <bhaddow@1f5c12ca-751b-0410-a591-d2e778427230>2009-02-12 15:58:27 +0300
commitbb9e2f427d2afebb1eac3abd3700ed9c25914c07 (patch)
tree6d35ea92cafad2c92b80087e778591989c089412 /mert/Point.cpp
parent8d5aef137b8da29817ae26e20d1255a72234ab89 (diff)
Fix random restarts so that they are actually random, using the system clock
for seeding. Previously, new mert followed old mert in using the same set of "random" points for every iteration of the outer loop. git-svn-id: https://mosesdecoder.svn.sourceforge.net/svnroot/mosesdecoder/trunk@2126 1f5c12ca-751b-0410-a591-d2e778427230
Diffstat (limited to 'mert/Point.cpp')
-rw-r--r--mert/Point.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/mert/Point.cpp b/mert/Point.cpp
index 25a0a3529..d68d04904 100644
--- a/mert/Point.cpp
+++ b/mert/Point.cpp
@@ -1,5 +1,6 @@
#include "Point.h"
#include<cmath>
+#include<cstdlib>
#include <cassert>
using namespace std;
@@ -17,7 +18,7 @@ void Point::Randomize(const vector<parameter_t>& min,const vector<parameter_t>&
assert(min.size()==Point::dim);
assert(max.size()==Point::dim);
for (unsigned int i=0; i<size(); i++)
- operator[](i)= min[i] + (float)random()/(float)RAND_MAX * (float)(max[i]-min[i]);
+ operator[](i)= min[i] + (float)rand()/(float)RAND_MAX * (float)(max[i]-min[i]);
}
void Point::NormalizeL2(){