Bertini 2 d882924 (2026-10-06 19:56 UTC)
Numerical algebraic geometry library (C++ core)
Loading...
Searching...
No Matches
random.hpp File Reference

stuff for generating random numbers More...

#include "bertini2/mpfr_complex.hpp"
#include "bertini2/records/derive.hpp"
#include <boost/random.hpp>
#include <random>
#include <cstdint>
Include dependency graph for random.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

namespace  bertini
namespace  bertini::multiprecision

Typedefs

using bertini::multiprecision::complex = bertini::complex_mp
 Shorthand for the multiprecision complex type within this namespace.

Functions

std::mt19937 & bertini::ThreadEngine ()
 Returns this thread's canonical mt19937 engine.
void bertini::SetGlobalSeed (unsigned long seed)
 Set the global RNG seed.
unsigned long bertini::SetGlobalSeedFromEntropy ()
 Set the global RNG seed to one drawn from std::random_device, and return it, so the run can be reproduced by setting that seed.
unsigned long bertini::ApplyClassicRandomSeed (unsigned long randomseed)
 Apply a classic input file's randomseed, as Bertini 1 does: 0, the default, draws a seed from entropy; any other value is the seed.
unsigned long bertini::GetGlobalSeed ()
 Returns the effective global seed.
void bertini::ReseedThisThread (uint64_t stream_key)
 Reseed this thread's engine deterministically from the global seed mixed with stream_key.
unsigned long bertini::DerivedWorkerSeed (uint64_t worker_index)
 Derive a distinct, deterministic child seed for a worker rank from the global (master) seed.
unsigned long bertini::DeriveSolveSeed ()
 Derive an EFFECTIVE PER-SOLVE SEED from the current master.
template<unsigned long digits = 50>
mpz_int bertini::RandomInt ()
 Generate a random integer number between -10^digits and 10^digits.
template<unsigned long digits = 50>
mpq_rational bertini::RandomRat ()
 Generate a random rational number with numerator and denomenator between -10^digits and 10^digits.
template<unsigned int length_in_digits>
real_mp bertini::RandomMp ()
 Produce a random number with at length_in_digits non-zero digits.
template<unsigned int length_in_digits>
void bertini::RandomMpAssign (real_mp &a)
 a templated function for producing random numbers in the unit interval, of a given number of digits.
template<unsigned int length_in_digits>
real_mp bertini::RandomMp (const real_mp &left, const real_mp &right)
 a templated function for producing random numbers in a specified interval, of a given number of digits.
real_mp bertini::RandomMp ()
 create a random number, at the current default precision
real_mp bertini::RandomMp (unsigned num_digits)
 create a random number, at the specified precision
real_mp bertini::RandomMp (const real_mp &a, const real_mp &b)
 create a random number in a given interval, at the current default precision
real_mp bertini::RandomMp (const real_mp &a, const real_mp &b, unsigned num_digits)
 create a random number in a given interval, at the specified precision
void bertini::RandomMpAssign (real_mp &a, unsigned num_digits)
 Set an existing real_mp to a random number, to a given precision.
void bertini::multiprecision::RandomRealAssign (complex &a, unsigned num_digits)
 Assign to a random real number $\in [-1,\,1]$, to current default precision.
complex bertini::multiprecision::RandomReal ()
 Produce a random real number $\in [-1,\,1]$, to current default precision.
complex bertini::multiprecision::RandomReal (unsigned num_digits)
 Produce a random real number $\in [-1,\,1]$, to specified precision.
complex bertini::multiprecision::rand ()
 Produce a random complex number, to default precision.
complex bertini::multiprecision::rand_unit ()
 Produce a random unit complex number, to default precision.
complex bertini::multiprecision::RandomUnit ()
 Produce a random unit-modulus complex number, to default precision.
complex bertini::multiprecision::rand_bounded_modulus ()
 Produce a random complex number whose modulus is pulled toward 1, to default precision.
complex bertini::multiprecision::RandomComplexBoundedModulus ()
 Produce a random complex number whose modulus is pulled toward 1 (away from 0 and infinity), at default precision.
void bertini::multiprecision::RandomComplexBoundedModulusAssign (complex &a, unsigned num_digits)
 Assign to a a random complex number whose modulus is pulled toward 1, at the given precision.
complex bertini::multiprecision::RandomComplexBoundedModulus (unsigned num_digits)
 Produce a random complex number whose modulus is pulled toward 1, at the given precision.
complex bertini::multiprecision::rand_real_bounded_modulus ()
 Produce a random REAL number whose modulus is pulled toward 1, to default precision.
complex bertini::multiprecision::RandomRealBoundedModulus ()
 Produce a random REAL number (imaginary part 0) whose modulus is pulled toward 1, at default precision.
void bertini::multiprecision::RandomRealBoundedModulusAssign (complex &a, unsigned num_digits)
 Assign to a a random REAL number (imaginary part 0) whose modulus is pulled toward 1, at the given precision.
complex bertini::multiprecision::RandomRealBoundedModulus (unsigned num_digits)
 Produce a random REAL number (imaginary part 0) whose modulus is pulled toward 1, at the given precision.
void bertini::multiprecision::rand_assign (complex &a, unsigned num_digits)
 Assign a random complex number to a, at the given precision.
void bertini::multiprecision::RandomComplexAssign (complex &a, unsigned num_digits)
 Assign a random complex number to a, at the given precision.
complex bertini::multiprecision::RandomComplex (unsigned num_digits)
 Produce a random complex number, at the given precision.
void bertini::multiprecision::RandomUnitAssign (complex &a, unsigned num_digits)
 Assign a random unit-modulus complex number to a, at the given precision.
complex bertini::multiprecision::RandomUnit (unsigned num_digits)
 Produce a random unit-modulus complex number, at the given precision.
template<unsigned int length_in_digits>
real_mp bertini::multiprecision::RandomMp ()
 Produce a random number with at length_in_digits non-zero digits.

Detailed Description

stuff for generating random numbers