File tree Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -66,18 +66,21 @@ size_t _swift_stdlib_malloc_size(const void *ptr) {
66
66
#error No malloc_size analog known for this platform/libc.
67
67
#endif
68
68
69
- static std::mt19937 MersenneRandom;
69
+ static std::mt19937 &getGlobalMT19937 () {
70
+ static std::mt19937 MersenneRandom;
71
+ return MersenneRandom;
72
+ }
70
73
71
- __swift_uint32_t _swift_stdlib_cxx11_mt19937 (void ) {
72
- return MersenneRandom ();
74
+ __swift_uint32_t _swift_stdlib_cxx11_mt19937 () {
75
+ return getGlobalMT19937 () ();
73
76
}
74
77
75
78
__swift_uint32_t
76
79
_swift_stdlib_cxx11_mt19937_uniform (__swift_uint32_t upper_bound) {
77
80
if (upper_bound > 0 )
78
81
upper_bound--;
79
82
std::uniform_int_distribution<__swift_uint32_t > RandomUniform (0 , upper_bound);
80
- return RandomUniform (MersenneRandom );
83
+ return RandomUniform (getGlobalMT19937 () );
81
84
}
82
85
83
86
} // namespace swift
You can’t perform that action at this time.
0 commit comments