2859{
2860#if (MPFR_VERSION >= MPFR_VERSION_NUM(3,0,0))
2861 static gmp_randstate_t
state;
2862 static bool initialize = true;
2863
2864 if(initialize)
2865 {
2866 gmp_randinit_default(
state);
2867 gmp_randseed_ui(
state,0);
2868 initialize = false;
2869 }
2870
2871 if(seed != 0) gmp_randseed_ui(
state,seed);
2872
2873 return mpfr::urandom(
state);
2874#else
2875 if(seed != 0) std::srand(seed);
2876 return mpfr::mpreal(std::rand()/(double)RAND_MAX);
2877#endif
2878}
static gmp_randstate_t state