std::linear_congruential - Online Linux Manual PageSection : 3
Updated : 19 Jun 2018
Source : libstdc++
NAMEstd::linear_congruential − A model of a linear congruential random number generator.
SYNOPSIS
Public Typestypedef _UIntType result_type
Public Member Functionstemplate<class _Gen > linear_congruential (_Gen &__g)
linear_congruential (unsigned long __x0=1)
result_type max () const
result_type min () const
result_type operator() ()
template<class _Gen > void seed (_Gen &__g)
void seed (unsigned long __s=1)
Static Public Attributesstatic const _UIntType increment
static const _UIntType modulus
static const _UIntType multiplier
Friendsbool operator!= (const linear_congruential &__lhs, const linear_congruential &__rhs)
template<class _UIntType1 , _UIntType1 __a1, _UIntType1 __c1, _UIntType1 __m1, typename _CharT , typename _Traits > std::basic_ostream< _CharT, _Traits > & operator<< (std::basic_ostream< _CharT, _Traits > &__os, const linear_congruential< _UIntType1, __a1, __c1, __m1 > &__lcr)
bool operator== (const linear_congruential &__lhs, const linear_congruential &__rhs)
template<class _UIntType1 , _UIntType1 __a1, _UIntType1 __c1, _UIntType1 __m1, typename _CharT , typename _Traits > std::basic_istream< _CharT, _Traits > & operator>> (std::basic_istream< _CharT, _Traits > &__is, linear_congruential< _UIntType1, __a1, __c1, __m1 > &__lcr)
Detailed Description
template<class _UIntType, _UIntType __a, _UIntType __c, _UIntType __m> class std::linear_congruential< _UIntType, __a, __c, __m >A model of a linear congruential random number generator. A random number generator that produces pseudorandom numbers using the linear function $x_{i+1}\leftarrow(ax_{i} + c) \bmod m $. The template parameter _UIntType must be an unsigned integral type large enough to store values up to (__m-1). If the template parameter __m is 0, the modulus __m used is std::numeric_limits<_UIntType>::max() plus 1. Otherwise, the template parameters __a and __c must be less than __m. The size of the state is $ 1 $. Definition at line 346 of file tr1_impl/random.
Member Typedef Documentation
template<class _UIntType, _UIntType __a, _UIntType __c, _UIntType __m> typedef _UIntType std::linear_congruential< _UIntType, __a, __c, __m >::result_type The type of the generated random value.Definition at line 353 of file tr1_impl/random.
Constructor & Destructor Documentation
template<class _UIntType, _UIntType __a, _UIntType __c, _UIntType __m> std::linear_congruential< _UIntType, __a, __c, __m >::linear_congruential (unsigned long __x0 = 1) [inline, explicit] Constructs a linear_congruential random number generator engine with seed __s. The default seed value is 1.Parameters: __s The initial seed value. Definition at line 369 of file tr1_impl/random. References std::linear_congruential< _UIntType, __a, __c, __m >::seed().
template<class _UIntType, _UIntType __a, _UIntType __c, _UIntType __m> template<class _Gen > std::linear_congruential< _UIntType, __a, __c, __m >::linear_congruential (_Gen & __g) [inline] Constructs a linear_congruential random number generator engine seeded from the generator function __g.Parameters: __g The seed generator function. Definition at line 379 of file tr1_impl/random. References std::linear_congruential< _UIntType, __a, __c, __m >::seed().
Member Function Documentation
template<class _UIntType, _UIntType __a, _UIntType __c, _UIntType __m> result_type std::linear_congruential< _UIntType, __a, __c, __m >::max () const [inline] Gets the largest possible value in the output range.Definition at line 416 of file tr1_impl/random.
template<class _UIntType, _UIntType __a, _UIntType __c, _UIntType __m> result_type std::linear_congruential< _UIntType, __a, __c, __m >::min () const [inline] Gets the smallest possible value in the output range.The minimum depends on the __c parameter: if it is zero, the minimum generated must be > 0, otherwise 0 is allowed. Definition at line 409 of file tr1_impl/random.
template<class _UIntType , _UIntType __a, _UIntType __c, _UIntType __m> linear_congruential< _UIntType, __a, __c, __m >::result_type std::linear_congruential< _UIntType, __a, __c, __m >::operator() () [inline] Gets the next random number in the sequence.Gets the next generated value in sequence. Definition at line 130 of file random.tcc.
template<class _UIntType, _UIntType __a, _UIntType __c, _UIntType __m> template<class _Gen > void std::linear_congruential< _UIntType, __a, __c, __m >::seed (_Gen & __g) [inline] Reseeds the linear_congruential random number generator engine sequence using values from the generator function __g.Parameters: __g the seed generator function. Definition at line 399 of file tr1_impl/random. References std::linear_congruential< _UIntType, __a, __c, __m >::seed(). Referenced by std::linear_congruential< _UIntType, __a, __c, __m >::seed().
template<class _UIntType , _UIntType __a, _UIntType __c, _UIntType __m> void std::linear_congruential< _UIntType, __a, __c, __m >::seed (unsigned long __x0 = 1) [inline] Reseeds the linear_congruential random number generator engine sequence to the seed __s.Parameters: __s The new seed. Seeds the LCR with integral value __x0, adjusted so that the ring identity is never a member of the convergence set. Definition at line 98 of file random.tcc. Referenced by std::linear_congruential< _UIntType, __a, __c, __m >::linear_congruential().
Friends And Related Function Documentation
template<class _UIntType, _UIntType __a, _UIntType __c, _UIntType __m> bool operator!= (const linear_congruential< _UIntType, __a, __c, __m > & __lhs, const linear_congruential< _UIntType, __a, __c, __m > & __rhs) [friend] Compares two linear congruential random number generator objects of the same type for inequality.Parameters: __lhs A linear congruential random number generator object.
__rhs Another linear congruential random number generator obj. Returns: true if the two objects are not equal, false otherwise. Definition at line 449 of file tr1_impl/random.
template<class _UIntType, _UIntType __a, _UIntType __c, _UIntType __m> template<class _UIntType1 , _UIntType1 __a1, _UIntType1 __c1, _UIntType1 __m1, typename _CharT , typename _Traits > std::basic_ostream<_CharT, _Traits>& operator<< (std::basic_ostream< _CharT, _Traits > & __os, const linear_congruential< _UIntType1, __a1, __c1, __m1 > & __lcr) [friend] Writes the textual representation of the state x(i) of x to __os.Parameters: __os The output stream.
__lcr A % linear_congruential random number generator. Returns: __os.
template<class _UIntType, _UIntType __a, _UIntType __c, _UIntType __m> bool operator== (const linear_congruential< _UIntType, __a, __c, __m > & __lhs, const linear_congruential< _UIntType, __a, __c, __m > & __rhs) [friend] Compares two linear congruential random number generator objects of the same type for equality.Parameters: __lhs A linear congruential random number generator object.
__rhs Another linear congruential random number generator obj. Returns: true if the two objects are equal, false otherwise. Definition at line 435 of file tr1_impl/random.
template<class _UIntType, _UIntType __a, _UIntType __c, _UIntType __m> template<class _UIntType1 , _UIntType1 __a1, _UIntType1 __c1, _UIntType1 __m1, typename _CharT , typename _Traits > std::basic_istream<_CharT, _Traits>& operator>> (std::basic_istream< _CharT, _Traits > & __is, linear_congruential< _UIntType1, __a1, __c1, __m1 > & __lcr) [friend] Sets the state of the engine by reading its textual representation from __is.The textual representation must have been previously written using an output stream whose imbued locale and whose type's template specialization arguments _CharT and _Traits were the same as those of __is. Parameters: __is The input stream.
__lcr A % linear_congruential random number generator. Returns: __is.
Member Data Documentation
template<class _UIntType, _UIntType __a, _UIntType __c, _UIntType __m> const _UIntType std::linear_congruential< _UIntType, __a, __c, __m >::increment [static] An increment.Definition at line 358 of file tr1_impl/random.
template<class _UIntType, _UIntType __a, _UIntType __c, _UIntType __m> const _UIntType std::linear_congruential< _UIntType, __a, __c, __m >::modulus [static] The modulus.Definition at line 360 of file tr1_impl/random.
template<class _UIntType, _UIntType __a, _UIntType __c, _UIntType __m> const _UIntType std::linear_congruential< _UIntType, __a, __c, __m >::multiplier [static] The multiplier.Definition at line 356 of file tr1_impl/random.
AuthorGenerated automatically by Doxygen for libstdc++ from the source code. 0
Johanes Gumabo
Data Size : 41,787 byte
man-std::linear_congruential.3Build : 2024-12-05, 20:55 :
Visitor Screen : x
Visitor Counter ( page / site ) : 3 / 182,846
Visitor ID : :
Visitor IP : 3.138.114.198 :
Visitor Provider : AMAZON-02 :
Provider Position ( lat x lon ) : 39.962500 x -83.006100 : x
Provider Accuracy Radius ( km ) : 1000 :
Provider City : Columbus :
Provider Province : Ohio , : ,
Provider Country : United States :
Provider Continent : North America :
Visitor Recorder : Version :
Visitor Recorder : Library :
Online Linux Manual Page : Version : Online Linux Manual Page - Fedora.40 - march=x86-64 - mtune=generic - 24.12.05
Online Linux Manual Page : Library : lib_c - 24.10.03 - march=x86-64 - mtune=generic - Fedora.40
Online Linux Manual Page : Library : lib_m - 24.10.03 - march=x86-64 - mtune=generic - Fedora.40
Data Base : Version : Online Linux Manual Page Database - 24.04.13 - march=x86-64 - mtune=generic - fedora-38
Data Base : Library : lib_c - 23.02.07 - march=x86-64 - mtune=generic - fedora.36
Very long time ago, I have the best tutor, Wenzel Svojanovsky . If someone knows the email address of Wenzel Svojanovsky , please send an email to johanes_gumabo@yahoo.co.id .
If error, please print screen and send to johanes_gumabo@yahoo.co.id
Under development. Support me via PayPal.
ERROR : Need New Coding : (rof_L|13|std::linear_congruential.3|79|\leftarrow(ax_{i} + c) \bmod m $. |A random number generator that produces pseudorandom numbers using the linear function $x_{i+1}\leftarrow(ax_{i} + c) \bmod m $.
)