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

github.com/moses-smt/vowpal_wabbit.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHal Daume III <me@hal3.name>2013-01-10 03:30:15 +0400
committerHal Daume III <me@hal3.name>2013-01-10 03:30:15 +0400
commit05ccc1f653ec30b8f35ce3bb28d3ce570cd20ba7 (patch)
tree741e690b0c54475bd7d49c16c9d94de4b7e4b4fa /vowpalwabbit/rand48.cc
parent92552edf319b5d2945526eab1cae3dab52b17dbe (diff)
fixed some random number stuff
Diffstat (limited to 'vowpalwabbit/rand48.cc')
-rw-r--r--vowpalwabbit/rand48.cc13
1 files changed, 7 insertions, 6 deletions
diff --git a/vowpalwabbit/rand48.cc b/vowpalwabbit/rand48.cc
index d7aa5ff5..5da05cea 100644
--- a/vowpalwabbit/rand48.cc
+++ b/vowpalwabbit/rand48.cc
@@ -3,7 +3,7 @@
#include <iostream>
using namespace std;
-uint64_t a = 0x5DEECE66D;
+uint64_t a = 0xEECE66D5DEECE66D;
uint64_t c = 2147483647;
int bias = 127 << 23;
@@ -11,7 +11,7 @@ int bias = 127 << 23;
float merand48(uint64_t& initial)
{
initial = a * initial + c;
- int32_t temp = (initial >> 41) | bias;
+ int32_t temp = ((initial >> 25) & 0x7FFFFF) | bias;
return *(float *)&temp - 1;
}
@@ -27,14 +27,15 @@ float frand48()
return merand48(v);
}
-
/*
-
-int mantissa = 128 << 15;
+//int mantissa = 128 << 15;
int main(int argc, char *argv[])
{
- for (size_t i = 0 ; i < 100000; i++)
+ for (size_t i = 0 ; i < 100000; i++) {
+ msrand48(i);
cout << frand48() << endl;
+ }
}
+
*/