28#ifndef BERTINI_RANDOM_HPP
29#define BERTINI_RANDOM_HPP
36#include <boost/random.hpp>
128 template <
unsigned long digits = 50>
140 template <
unsigned long digits = 50>
147 mpz_int const num = stream.IntSymmetric(bound);
148 mpz_int den = stream.IntSymmetric(bound);
150 den = stream.IntSymmetric(bound);
160 template <
unsigned int length_in_digits>
177 template <
unsigned int length_in_digits>
191 template <
unsigned int length_in_digits>
311 return returnme / abs(returnme);
359 a.precision(num_digits);
373 a = std::move(z / sqrt(m));
419 a.precision(num_digits);
428 a = std::move(z / sqrt(m));
478 a.precision(num_digits);
484 a = std::move(temp/abs(temp));
real_mp UnitRealMp(unsigned digits)
Uniform on [0,1) at digits decimal digits: ldexp(Bits(k), -k) with k = ceil(digits*log2(10)) + 1,...
mpz_int IntSymmetric(mpz_int const &bound)
Uniform integer on [-bound, bound], by rejection over Bits(bitlen(2*bound)).
Seed-rooted, fully-specified random derivation (b2rand/1; ADR-0044; the structured-output-directory a...
The main multiprecision complex number type.
Definition random.hpp:238
complex rand_bounded_modulus()
Produce a random complex number whose modulus is pulled toward 1, to default precision.
Definition random.hpp:330
complex RandomComplex(unsigned num_digits)
Produce a random complex number, at the given precision.
Definition random.hpp:465
void RandomComplexBoundedModulusAssign(complex &a, unsigned num_digits)
Assign to a a random complex number whose modulus is pulled toward 1, at the given precision.
Definition random.hpp:355
void RandomUnitAssign(complex &a, unsigned num_digits)
Assign a random unit-modulus complex number to a, at the given precision.
Definition random.hpp:474
void rand_assign(complex &a, unsigned num_digits)
Assign a random complex number to a, at the given precision.
Definition random.hpp:443
complex RandomRealBoundedModulus()
Produce a random REAL number (imaginary part 0) whose modulus is pulled toward 1, at default precisio...
Definition random.hpp:408
bertini::complex_mp complex
Shorthand for the multiprecision complex type within this namespace.
Definition random.hpp:241
complex rand_unit()
Produce a random unit complex number, to default precision.
Definition random.hpp:305
void RandomRealBoundedModulusAssign(complex &a, unsigned num_digits)
Assign to a a random REAL number (imaginary part 0) whose modulus is pulled toward 1,...
Definition random.hpp:415
complex RandomReal()
Produce a random real number , to current default precision.
Definition random.hpp:262
complex rand_real_bounded_modulus()
Produce a random REAL number whose modulus is pulled toward 1, to default precision.
Definition random.hpp:395
void RandomRealAssign(complex &a, unsigned num_digits)
Assign to a random real number , to current default precision.
Definition random.hpp:250
complex rand()
Produce a random complex number, to default precision.
Definition random.hpp:288
complex RandomComplexBoundedModulus()
Produce a random complex number whose modulus is pulled toward 1 (away from 0 and infinity),...
Definition random.hpp:348
complex RandomUnit()
Produce a random unit-modulus complex number, to default precision.
Definition random.hpp:315
void RandomComplexAssign(complex &a, unsigned num_digits)
Assign a random complex number to a, at the given precision.
Definition random.hpp:458
real_mp RandomMp()
Produce a random number with at length_in_digits non-zero digits.
Definition random.hpp:161
DrawStream & ThreadDrawStream()
This thread's pinned draw stream — the source of every identity-relevant random draw in bertini2.
Definition algorithm_builder.hpp:36
unsigned long ApplyClassicRandomSeed(unsigned long randomseed)
Apply a classic input file's randomseed, as Bertini 1 does: 0, the default, draws a seed from entropy...
boost::multiprecision::number< boost::multiprecision::backends::gmp_int, boost::multiprecision::et_on > mpz_int
The arbitrary-precision integer type.
Definition mpfr_extensions.hpp:54
void SetGlobalSeed(unsigned long seed)
Set the global RNG seed.
std::mt19937 & ThreadEngine()
Returns this thread's canonical mt19937 engine.
unsigned long GetGlobalSeed()
Returns the effective global seed.
mpz_int RandomInt()
Generate a random integer number between -10^digits and 10^digits.
Definition random.hpp:130
void ReseedThisThread(uint64_t stream_key)
Reseed this thread's engine deterministically from the global seed mixed with stream_key.
void SetThreadPrecision(unsigned prec)
Set the precision (digits) for the current thread only (does not touch the global default).
Definition mpfr_complex.hpp:176
unsigned long DeriveSolveSeed()
Derive an EFFECTIVE PER-SOLVE SEED from the current master.
unsigned long DerivedWorkerSeed(uint64_t worker_index)
Derive a distinct, deterministic child seed for a worker rank from the global (master) seed.
unsigned long SetGlobalSeedFromEntropy()
Set the global RNG seed to one drawn from std::random_device, and return it, so the run can be reprod...
bmp::number< mpc_complex_backend< 0 >, bmp::et_on > complex_mp
The arbitrary-precision complex number type.
Definition mpfr_complex.hpp:58
boost::multiprecision::number< boost::multiprecision::mpfr_float_backend< 0 >, boost::multiprecision::et_on > real_mp
The arbitrary-precision real number type.
Definition mpfr_extensions.hpp:53
void RandomMpAssign(real_mp &a)
a templated function for producing random numbers in the unit interval, of a given number of digits.
Definition random.hpp:178
unsigned ThreadPrecision()
Get the current thread's precision (digits).
Definition mpfr_complex.hpp:183
mpq_rational RandomRat()
Generate a random rational number with numerator and denomenator between -10^digits and 10^digits.
Definition random.hpp:141
boost::multiprecision::number< boost::multiprecision::backends::gmp_rational, boost::multiprecision::et_on > mpq_rational
The exact rational number type.
Definition mpfr_extensions.hpp:55
real_mp RandomMp()
Produce a random number with at length_in_digits non-zero digits.
Definition random.hpp:161