The type of the Random Number Generator's argument. This must be an integral type. | |
Result type | The type returned when the Random Number Generator is called. It must be the same as the argument type. |
F
A type that is a model of Random Number Generator.
Integer
The argument type of
f
Object of type
N
Object of type
The
The
None, except for those defined by Unary Function.
Name | Expression | Precondition | Semantics | Postcondition |
---|---|---|---|---|
Function call | f(N) | Returns a pseudo-random number of type | The return value is less than |
Uniformity | In the limit as |
[1] Uniform distribution means that all of the numbers in the range
[2] Random number generators are a very subtle subject: a good random number generator must satisfy many statistical properties beyond uniform distribution. See section 3.4 of Knuth for a discussion of what it means for a sequence to be random, and section 3.2 for several algorithms that may be used to write random number generators. (D. E. Knuth,
Predefined function objects
Arithmetic operations
plus<T>
Category: functors
Component type: type
Each element in
const int N = 1000;
vector<double> V1(N);
vector<double> V2(N);
vector<double> V3(N);
iota(V1.begin(), V1.end(), 1);
fill(V2.begin(), V2.end(), 75);
assert(V2.size() >= V1.size() && V3.size() >= V1.size());
transform(V1.begin(), V1.end(), V2.begin(), V3.begin(), plus<double>());
Defined in the standard header functional, and in the nonstandard backward-compatibility header function.h.
Parameter | Description |
---|---|
T |