| ... |
... |
@@ -566,24 +566,44 @@
|
| 566 |
566 |
///
|
| 567 |
567 |
/// Assign operator. The generated sequence will be identical to
|
| 568 |
568 |
/// the other sequence. It can be used to save the current state
|
| 569 |
569 |
/// of the generator and later use it to generate the same
|
| 570 |
570 |
/// sequence.
|
| 571 |
571 |
Random& operator=(const Random& other) {
|
| 572 |
572 |
if (&other != this) {
|
| 573 |
573 |
core.copyState(other.core);
|
| 574 |
574 |
}
|
| 575 |
575 |
return *this;
|
| 576 |
576 |
}
|
| 577 |
577 |
|
|
578 |
/// \brief Seeding random sequence
|
|
579 |
///
|
|
580 |
/// Seeding the random sequence. The current number type will be
|
|
581 |
/// converted to the architecture word type.
|
|
582 |
template <typename Number>
|
|
583 |
void seed(Number seed) {
|
|
584 |
_random_bits::Initializer<Number, Word>::init(core, seed);
|
|
585 |
}
|
|
586 |
|
|
587 |
/// \brief Seeding random sequence
|
|
588 |
///
|
|
589 |
/// Seeding the random sequence. The given range should contain
|
|
590 |
/// any number type and the numbers will be converted to the
|
|
591 |
/// architecture word type.
|
|
592 |
template <typename Iterator>
|
|
593 |
void seed(Iterator begin, Iterator end) {
|
|
594 |
typedef typename std::iterator_traits<Iterator>::value_type Number;
|
|
595 |
_random_bits::Initializer<Number, Word>::init(core, begin, end);
|
|
596 |
}
|
|
597 |
|
| 578 |
598 |
/// \brief Returns a random real number from the range [0, 1)
|
| 579 |
599 |
///
|
| 580 |
600 |
/// It returns a random real number from the range [0, 1). The
|
| 581 |
601 |
/// default Number type is \c double.
|
| 582 |
602 |
template <typename Number>
|
| 583 |
603 |
Number real() {
|
| 584 |
604 |
return _random_bits::RealConversion<Number, Word>::convert(core);
|
| 585 |
605 |
}
|
| 586 |
606 |
|
| 587 |
607 |
double real() {
|
| 588 |
608 |
return real<double>();
|
| 589 |
609 |
}
|