-
Notifications
You must be signed in to change notification settings - Fork 182
Commit
- Loading branch information
There are no files selected for viewing
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,6 +26,13 @@ THE SOFTWARE. | |
#include <cstdlib> | ||
#include <stdio.h> | ||
#include <limits> | ||
#include <random> | ||
|
||
#define unif_uint_dist(x,y) std::uniform_int_distribution<> x(0, y) | ||
inline uint32_t rnd_uint(std::mt19937_64& mtrand, const uint32_t maximum) { | ||
unif_uint_dist(u, maximum); | ||
return u(mtrand); | ||
} | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
msoos
Author
Owner
|
||
|
||
// #define VERBOSE_DEBUG | ||
// #define VERBOSE_DEBUG_FULLPROP | ||
|
Two quick notes on this
there is a type mismatch between the defaulted
std::uniform_int_distribution<>
and the return type -> the default is to returnint
s, notuint32_t
. This mismatch can carry performance penalty, depending on how the distribution internally converts between types.This change means that the randomness in CMSat is no longer reproducible across different platforms (stdlibs) or their versions. Just on Windows, CMSat compiled with VS 2019 and VS 2022 will give different results for the same seed. The issue is that while the generators from
<random>
are specified to be reproducible, the distributions are not, and in fact various platforms have changed the underlying algorithms for uniform int distribution recently.