Now that we've seen how to generate random bits on demand, let's look at how to convert those random bits to numeric values matching a particular distribution. This two-step process--generate raw bits, and then format them into data values--is very similar to the two-step process of buffering and parsing we covered in Chapter 9, Iostreams. First, get the raw bits and bytes, then perform some kind of operation to convert those bits and bytes into typed data values.
Given any distribution object dist, you can perform the following operations on it:
- dist(g): This yields the next output according to the appropriate mathematical distribution. It may require several calls to g(), or none at all, depending on the internal state of the dist object.
- dist.reset(): This clears the internal state of the dist object, if any. You'll never need to use...