argument_type | Adaptable Unary Function | The type of |
result_type | Adaptable Unary Function | The type of the result: |
const Pair::second_type& operator()(const Pair& p) const | Adaptable Unary Function | Function call. The return value is |
All of
[1]
subtractive_rng
Category: functors
Component type: type
int main() {
subtractive_rng R;
for (int i = 0; i < 20; ++i) cout << R(5) << ' ';
cout << endl;
}
// The output is 3 2 3 2 4 3 1 1 2 2 0 3 4 4 4 4 2 1 0 0
Defined in the standard header functional, and in the nonstandard backward-compatibility header function.h. This function object is an SGI extension; it is not part of the C++ standard.
None.
Random Number Generator, Adaptable Unary Function
None.
unary_function<unsigned int, unsigned int>
Parameter | Description | Default |
---|---|---|
argument_type | Adaptable Unary Function | The type of a |
result_type | Adaptable Unary Function | The type of the result: |
subtractive_rng(unsigned int seed) | subtractive_rng | See below. |
subtractive_rng() | subtractive_rng | See below. |
unsigned int operator()(unsigned int N) | Adaptable Unary Function | Function call. Returns a pseudo-random number in the range |
void initialize(unsigned int seed) | subtractive_rng | See below. |