Revisión | 9f495a9eda368cbffe44281e9b17cc113e11f64f (tree) |
---|---|
Tiempo | 2012-10-16 19:54:47 |
Autor | h2so5 <h2so5@git....> |
Commiter | h2so5 |
Math.randomを独自の関数で上書き、アルゴリズムをメルセンヌ・ツイスタに変更
@@ -7,6 +7,7 @@ | ||
7 | 7 | #include <string> |
8 | 8 | #include <functional> |
9 | 9 | #include <memory> |
10 | +#include <random> | |
10 | 11 | #include <v8.h> |
11 | 12 | #include <boost/thread.hpp> |
12 | 13 | #include <boost/timer.hpp> |
@@ -77,6 +78,8 @@ class ScriptEnvironment { | ||
77 | 78 | static Handle<Value> Function_Script_clearTimeout(const Arguments& args); |
78 | 79 | static Handle<Value> Function_Script_clearInterval(const Arguments& args); |
79 | 80 | |
81 | + static Handle<Value> Function_Math_random(const Arguments& args); | |
82 | + | |
80 | 83 | private: |
81 | 84 | void Error(const Handle<Value>& error); |
82 | 85 |
@@ -92,6 +95,8 @@ class ScriptEnvironment { | ||
92 | 95 | boost::condition_variable condition_; |
93 | 96 | boost::mutex mutex_; |
94 | 97 | |
98 | + static std::mt19937 random_engine; | |
99 | + | |
95 | 100 | static unsigned int max_execution_time; |
96 | 101 | static char SCRIPT_PATH[]; |
97 | 102 |
@@ -47,6 +47,7 @@ | ||
47 | 47 | #include <array> |
48 | 48 | #include <string> |
49 | 49 | #include <memory> |
50 | +#include <random> | |
50 | 51 | #include <iostream> |
51 | 52 | #include <fstream> |
52 | 53 | #include <algorithm> |