|
Krita Source Code Documentation
|
#include <kis_random_source.h>
Inheritance diagram for KisRandomSource:Classes | |
| struct | Private |
Public Member Functions | |
| qint64 | generate () const |
| int | generate (int min, int max) const |
| qreal | generateGaussian (qreal mean, qreal sigma) const |
| qreal | generateNormalized () const |
| KisRandomSource () | |
| KisRandomSource (const KisRandomSource &rhs) | |
| KisRandomSource (int seed) | |
| KisRandomSource & | operator= (const KisRandomSource &rhs) |
| ~KisRandomSource () | |
Public Member Functions inherited from KisShared | |
| bool | deref () |
| bool | ref () |
| int | refCount () |
| QAtomicInt * | sharedWeakReference () |
Private Attributes | |
| const QScopedPointer< Private > | m_d |
Additional Inherited Members | |
Protected Member Functions inherited from KisShared | |
| KisShared () | |
| ~KisShared () | |
KisRandomSource is a special object that wraps around random number generation routines.
It has the following properties:
1) Two KisRandomSource objects will generate exactly the same sequences of numbers if created with the same seed.
2) After copy-construction or assignment the two objects will continue to generate exactly the same numbers. Imagine like the history got forked.
3) Copying of a KisRandomSource object is fast. It uses Tauss88 algorithm to achieve this.
Definition at line 32 of file kis_random_source.h.
| KisRandomSource::KisRandomSource | ( | ) |
Definition at line 33 of file kis_random_source.cpp.
| KisRandomSource::KisRandomSource | ( | int | seed | ) |
Definition at line 38 of file kis_random_source.cpp.
| KisRandomSource::KisRandomSource | ( | const KisRandomSource & | rhs | ) |
| KisRandomSource::~KisRandomSource | ( | ) |
Definition at line 58 of file kis_random_source.cpp.
| qint64 KisRandomSource::generate | ( | ) | const |
Generates a random number in a range from min() to max()
Definition at line 62 of file kis_random_source.cpp.
References m_d.
| int KisRandomSource::generate | ( | int | min, |
| int | max ) const |
Generates a random number in a range from min to max
Definition at line 67 of file kis_random_source.cpp.
References m_d.
| qreal KisRandomSource::generateGaussian | ( | qreal | mean, |
| qreal | sigma ) const |
Generates a number from the Gaussian distribution
Definition at line 82 of file kis_random_source.cpp.
References m_d.
| qreal KisRandomSource::generateNormalized | ( | ) | const |
Generates a random number in a closed range [0; 1.0]
Definition at line 73 of file kis_random_source.cpp.
| KisRandomSource & KisRandomSource::operator= | ( | const KisRandomSource & | rhs | ) |
Definition at line 49 of file kis_random_source.cpp.
References m_d.
|
private |
Definition at line 64 of file kis_random_source.h.