# 28 Numerics library [numerics]

## 28.5 Random number generation [rand]

### 28.5.3 Requirements [rand.req]

#### 28.5.3.6 Random number distribution requirements [rand.req.dist]

Table 100: Random number distribution requirements [tab:rand.req.dist]
 ðŸ”— Expression Return type Pre/post-condition Complexity ðŸ”— D​::​result_type T T is an arithmetic type. compile-time ðŸ”— D​::​param_type P compile-time ðŸ”— D() Creates a distribution whose behavior is indistinguishable from that of any other newly default-constructed distribution of type D. constant ðŸ”— D(p) Creates a distribution whose behavior is indistinguishable from that of a distribution newly constructed directly from the values used to construct p. same as p's construction ðŸ”— d.reset() void Subsequent uses of d do not depend on values produced by any engine prior to invoking reset. constant ðŸ”— x.param() P Returns a value p such that D(p).param() == p. no worse than the complexity of D(p) ðŸ”— d.param(p) void Postconditions: d.param() == p. no worse than the complexity of D(p) ðŸ”— d(g) T With p=d.param(), the sequence of numbers returned by successive invocations with the same object g is randomly distributed according to the associated p(z |{p}) or P(zi|{p}) function. amortized constant number of invocations of g ðŸ”— d(g,p) T The sequence of numbers returned by successive invocations with the same objects g and p is randomly distributed according to the associated p(z |{p}) or P(zi|{p}) function. amortized constant number of invocations of g ðŸ”— x.min() T Returns glb. constant ðŸ”— x.max() T Returns lub. constant ðŸ”— x == y bool This operator is an equivalence relation. Returns true if x.param() == y.param() and S1=S2, where S1 and S2 are the infinite sequences of values that would be generated, respectively, by repeated future calls to x(g1) and y(g2) whenever g1 == g2. Otherwise returns false. constant ðŸ”— x != y bool !(x == y). same as x == y. ðŸ”— os << x reference to the type of os Writes to os a textual representation for the parameters and the additional internal data of x.Postconditions: The os.fmtflags and fill character are unchanged. ðŸ”— is >> d reference to the type of is Restores from is the parameters and additional internal data of the lvalue d. If bad input is encountered, ensures that d is unchanged by the operation and calls is.setstate(ios_base​::​failbit) (which may throw ios_base​::​failure ([iostate.flags])).Preconditions: is provides a textual representation that was previously written using an os whose imbued locale and whose type's template specialization arguments charT and traits were the same as those of is.Postconditions: The is.fmtflags are unchanged.