Get rid of non-portable drand48. (#1349)

Summary: Pull Request resolved: https://github.com/facebookresearch/faiss/pull/1349

Reviewed By: mdouze

Differential Revision: D23289393

Pulled By: beauby

fbshipit-source-id: a626bbf252ced4ae01abbc3dce4be50d9e628728
This commit is contained in:
Lucas Hosseini
2020-08-24 00:42:21 -07:00
committed by Facebook GitHub Bot
parent 1d4b1571e9
commit c37e71456b
21 changed files with 119 additions and 40 deletions
+6 -1
View File
@@ -10,6 +10,7 @@
#include <memory>
#include <vector>
#include <random>
#include <gtest/gtest.h>
@@ -19,6 +20,7 @@
#include <faiss/index_io.h>
#include <faiss/IVFlib.h>
using namespace faiss;
namespace {
@@ -38,12 +40,15 @@ size_t nb = 1000;
// nb of queries
size_t nq = 200;
std::mt19937 rng;
std::vector<float> make_data(size_t n)
{
std::vector <float> database (n * d);
std::uniform_real_distribution<> distrib;
for (size_t i = 0; i < n * d; i++) {
database[i] = drand48();
database[i] = distrib(rng);
}
return database;
}