$Id: proposal.html,v 1.44 2002/11/10 20:42:15
jmaurer Exp $
Any one who considers arithmetical methods of producing random digits is, of course, in a state of sin.
John von Neumann, 1951
seed(first, last)
interface now needs "unsigned
long" values.Why is this important? What kinds of problems does it address, and what kinds of programmers, is it intended to support? Is it based on existing practice?Computers are deterministic machines by design: equal input data results in equal output, given the same internal state. Sometimes, applications require seemingly non-deterministic behaviour, usually provided by generating random numbers. Such applications include:
Programmers in all of the above areas have to find ways to generate random numbers. However, the difficulty to find generators that are both efficient and have good quality is often underestimated, and so ad-hoc implementations often fail to meet either or both of these goals.
The C++ standard library includes std::rand
, inherited from
the C standard library, as the only facility to generate pseudo-random
numbers. It is underspecified, because the generation function is not
defined, and indeed early C standard library implementations provided
surprisingly bad generators. Furthermore, the interface relies on global
state, making it difficult or inefficient to provide for correct operation
for simultaneous invocations in multi-threaded applications.
There is a lot of existing practice in this area. A multitude of libraries, usually implemented in C or Fortran, is available from the scientific community. Some implement just one random number engine, others seek to provide a full framework. I know of no comprehensive C++ framework for generating random numbers that adheres to the design principles put forth in section III.
Random number generators are appropriate for this TR because they fall into one of the domains (numerics) identified in N1314 as a target for the TR.
What does it depend on, and what depends on it? Is it a pure extension, or does it require changes to standard components? Does it require core language changes?This proposal is a pure library extension. It does not require changes to any standard classes or functions. It does not require changes to any of the standard requirement tables. It does not require any changes in the core language, and it has been implemented in standard C++ as per ISO 14882:1998.
The ISO C99 extension that specify integral types having a given minimum
or exact bitwidth (e.g. int32_t
) aids in implementing this
proposal, however these types (or the equivalent thereof under another
name) can be defined with template metaprogramming in standard C++, so
these are not strictly necessary.
In case the ISO C99 extensions become part of the TR, section IV should be reviewed whether some requirements could be reformulated with the ISO C99 extensions.
In case a standard reference-counted smart pointer becomes part of the
TR, section IV should be reviewed and instances of the smart pointer be
added to the acceptable template parameters for a
variate_generator
.
Why did you choose the specific design that you did? What alternatives did you consider, and what are the tradeoffs? What are the consequences of your choice, for users and implementors? What decisions are left up to implementors? If there are any similar libraries in use, how do their design decisions compare to yours?The design decisions are compared to those in the following libraries:
In this proposal, a pseudo-random number engine is defined as an initial internal state x(0), a function f that moves from one internal state to the next x(i+1) := f(x(i)), and an output function o that produces the output o(x(i)) of the generator. This is an entirely deterministic process, it is determined by the initial state x(0) and functions f and o only. The initial state x(0) is determined from a seed. Apparent randomness is achieved only because the user has limited perception.
A non-deterministic random-number engine provides a sequence of random numbers x(i) that cannot be foreseen. Examples are certain quantum-level physics experiments, measuring the time difference between radioactive decay of individual atoms or noise of a Zehner diode. Relatively unforeseeable random sources are also (the low bits of) timing between key touches, mouse movements, Ethernet packet arrivals, etc. An estimate for the amount of unforeseeability is the entropy, a concept from information theory. Completely foreseeable sequences (e.g., from pseudo-random number engines) have entropy 0, if all bits are unforeseeable, the entropy is equal to the number of bits in each number.
Pseudo-random number engines are usually much faster than non-deterministic random-number engines, because the latter require I/O to query some randomness device outside of the computer. However, there is a common interface feature subset of both pseudo-random and non-deterministic random-number engines. For example, a non-deterministic random-number engine could be employed to produce random numbers with normal distribution; I believe this to be an unlikely scenario in practice.
Other libraries, including those mentioned above, only provide either pseudo-random numbers, suitable for simulations and games, or non-deterministic random numbers, suitable for cryptographic applications.
This proposal honours this conceptual separation, and provides a class template to merge an arbitrary engine with an arbitrary distribution on top. To this end, this proposal sets up requirements for engines so that each of them can be used to provide uniformly distributed random numbers for any of the distributions. The resulting freedom of combination allows for the utmost re-use.
Engines have usually been analyzed with all mathematical and empirical tools currently available. Nonetheless, those tools show the absence of a particular weakness only, and are not exhaustive. Albeit unlikely, a new kind of test (for example, a use of random numbers in a new kind of simulation or game) could show serious weaknesses in some engines that were not known before.
This proposal attempts to specify the engines precisely; two different implementations, with the same seed, should return the same output sequence. This forces implementations to use the well-researched engines specified hereinafter, and users can have confidence in their quality and the limits thereof.
On the other hand, the specifications for the distributions only define the statistical result, not the precise algorithm to use. This is different from engines, because for distribution algorithms, rigorous proofs of their correctness are available, usually under the precondition that the input random numbers are (truely) uniformly distributed. For example, there are at least a handful of algorithms known to produce normally distributed random numbers from uniformly distributed ones. Which one of these is most efficient depends on at least the relative execution speeds for various transcendental functions, cache and branch prediction behaviour of the CPU, and desired memory use. This proposal therefore leaves the choice of the algorithm to the implementation. It follows that output sequences for the distributions will not be identical across implementations. It is expected that implementations will carefully choose the algorithms for distributions up front, since it is certainly surprising to customers if some distribution produces different numbers from one implementation version to the next.
Other libraries usually provide the same differentiation between engines and distributions. Libraries rarely have a wrapper around both engine and distribution, but it turns out that this can hide some complexities from the authors of distributions, since some facitilies need to be provided only once. A previous version of this proposal had distributions directly exposed to the user, and the distribution type dependent on the engine type. In various discussions, this was considered as too much coupling.
Since other libraries do not aim to provide a portable specification framework, engines are sometimes only described qualitatively without giving the exact parameterization. Also, distributions are given as specific functions or classes, so the quality-of-implementation question which distribution algorithm to employ does not need to be addressed.
For virtual functions in a class hierarchy, the core language requires a (nearly) exact type match for a function in a derived classes overriding a function in a base class. This seems to be unnecessarily restrictive, because engines can sometimes benefit from using different integral base types. Also, with current compiler technology, virtual functions prevent inlining when a pointer to the base class is used to call a virtual function that is overridden in some derived class. In particular with applications such as simulations that sometimes use millions of pseudo-random numbers per second, losing significant amounts of performance due to missed inlining opportunities appears to not be acceptable.
The CLHEP library bases all its engines on the abstract base class
HepRandomEngine
. Specific engines derive from this class and
override its pure virtual functions. Similarly, all distributions are based
on the base class HepRandom
. Specific distributions derive
from this class, override operator(), and provide a number of specific
non-virtual functions.
The GNU Scientific Library, while coded in C, adheres to the principles of object-structuring; all engines can be used with any of the distributions. The technical implementation is by mechanisms similar to virtual functions.
Since random-number engines are mathematically designed with computer implementation in mind, parameters are usually integers representable in a machine word, which usually coincides nicely with a C++ built-in type. The parameters could either be given as (compile-time) template arguments or as (run-time) constructor arguments.
Providing parameters as template arguments allows for providing predefined parameterizations as simple "typedef"s. Furthermore, the parameters appear as integral constants, so the compiler can value-check the given constants against the engine's base type. Also, the library implementor can choose different implementations depending on the values of the parameters, without incurring any runtime overhead. For example, there is an efficient method to compute (a*x) mod m, provided that a certain magnitude of m relative to the underlying type is not exceeded. Additionally, the compiler's optimizer can benefit from the constants and potentially produce better code, for example by unrolling loops with fixed loop count.
As an alternative, providing parameters as constructor arguments allows for more flexibility for the library user, for example when experimenting with several parameterizations. Predefined parameterizations can be provided by defining wrapper types which default the constructor parameters.
Other libraries have hard-coded the parameters of their engines and do not allow the user any configuration of them at all. If the user wishes to change the parameters, he has to re-implement the engine's algorithm. In my opinion, this approach unnecessarily restricts re-use.
Regarding initialization, this proposal chooses to provide
"deterministic seeding" with the default constructor and the
seed
function without parameters: Two engines constructed
using the default constructor will output the same sequence. In contrast,
the CLHEP library's default constructed engines will take a fresh seed from
a seed table for each instance. While this approach may be convenient for a
certain group of users, it relies on global state and can easily be
emulated by appropriately wrapping engines with deterministic seeding.
In addition to the default constructor, all engines provide a
constructor and seed
function taking an iterator range
[it1,it2) pointing to unsigned integral values. An engine initializes its
state by successively consuming values from the iterator range, then
returning the advanced iterator it1. This approach has the advantage that
the user can completely exploit the large state of some engines for
initialization. Also, it allows to initialize compound engines in a uniform
manner. For example, a compound engine consisting of two simpler engines
would initialize the first engine with its [it1,it2). The first engine
returns a smaller iterator range that it has not consumed yet. This can be
used to initialize the second engine.
The iterator range [it1,it2) is specified to point to unsigned long
values. There is no way to determine from a generic user program how the
initialization values will be treated and what range of bits must be
provided, except by enumerating all engines, e.g. in template
specializations. The problem is that a given generator might have differing
requirements on the values of the seed range even within one
seed
call.
For example, imagine a
xor_combine<lagged_fibonacci<...>, mersenne_twister<...> >generator. For this,
seed(first, last)
will consume values
as follows: First, seed the state of the lagged_fibonacci
generator by consuming one item from [first, last) for each word of state.
The values are reduced to (e.g.) 24 bits to fit the
lagged_fibonacci
state requirements. Then, seed the state of the
mersenne_twister
by consuming some number of items from the
remaining [first, last). The values are reduced to 32 bits to fit the
mersenne_twister
state requirements.
How does a concise programming interface for those increasingly complex and varying requirements on [first, last) look like? I don't know, and I don't want to complicate the specification by inventing something complicated here.
Thus, the specification says for each generator how it uses the seed values, and how many are consumed. Additional features are left to the user.
In a way, this is similar to STL containers: It is intended that the
user can exchange iterators to various containers in generic algorithms,
but the container itself is not meant to be exchanged, i.e. having a
Container template parameter is often not adequate. That is analogous to
the random number case: The user can pass an engine around and use its
operator()
and min
and max
functions
generically. However, the user can't generically query the engine
attributes and parameters, simply because most are entirely different in
semantics for each engine.
The seed(first, last)
interface can serve two purposes:
seed(uint32_t)
on top of seed(first, last)
, one
option is to use a linear_congruential
generator that
produces the values required for seed(first, last)
. When the
user defines the iterator type for first
and
last
so that it encapsulates the
linear_congruential
engine in operator++
, the
user doesn't even need to know beforehand how many values
seed(first, last)
will need.seed(first, last)
allows to know what values need to be
passed in so that a specific initial state is attained, for example to
compare one implementation of the engine with another one that uses
different seeding.I haven't seen the iterator-based approach to engine initialization in other libraries; most initialization approaches rely on a either a single value or on per-engine specific approaches to initialization.
An alternative approach is to pass a zero-argument function object ("generator") for seeding. It is trivial to implement a generator from a given iterator range, but it is more complicated to implement an iterator range from a generator. Also, the exception object that is specified to be thrown when the iterator range is exhausted could be configured in a user-provided iterator to generator mapping. With this approach, some engines would have three one-argument constructors: One taking a single integer for seeding, one taking a (reference?) to a (templated) generator, and the copy constructor. It appears that the opportunities for ambiguities or choosing the wrong overload are too confusing to the unsuspecting user.
float
,
double
, long double
) that the user desires.
The probability density functions of distributions usually have parameters. These are mapped to constructor parameters, to be set at runtime by the library user according to her requirements. The parameters for a distribution object cannot change after its construction. When constructing the distribution, this allows to pre-compute some data according to the parameters given without risk of inadvertently invalidating them later.
Distributions may implement operator()(T x)
, for arbitrary
type T
, to meet special needs, for example a "one-shot" mode
where each invocation uses different distribution parameters.
double
using
std::numeric_limits<>
. However, engines and
distributions cannot be simple types, so it does not appear to be necessary
to separate the properties into separate traits classes. Instead,
compile-time properties are given as members types and static member
constants.
Engines may be categorized according to the following dimensions.
| engine | int / float | quality | speed | size of state | subsequences | comments |
|---|---|---|---|---|---|---|
| linear_congruential | int | medium | medium | 1 word | yes | cycle length is limited to the maximum value representable in one machine word, passes most statisticial tests with chosen parameters. |
| mersenne_twister | int | good | fast | 624 words | no | long cycles, passes all statistical tests, good equidistribution in high dimensions |
| subtract_with_carry | both | medium | fast | 25 words | no | very long cycles possible, fails some statistical tests. Can be improved with the discard_block compound engine. |
| discard_block | both | good | slow | base engine + 1 word | no | compound engine that removes correlation provably by throwing away significant chunks of the base engine's sequence, the resulting speed is reduced to 10% to 3% of the base engine's. |
| xor_combine | int | good | fast | base engines | yes, if one of the base engines | compound engine that XOR-combines the sequences of two base engines |
Some engines were considered for inclusion, but left out for the following reasons:
| engine | int / float | quality | speed | size of state | subsequences | comments |
|---|---|---|---|---|---|---|
| shuffle_output | int | good | fast | base engine + 100 words | no | compound engine that reorders the base engine's output, little overhead for generation (one multiplication) |
| lagged_fibonacci | both | medium | fast | up to 80,000 words | no | very long cycles possible, fails birthday spacings test. Same
principle of generation as subtract_with_carry , i.e. x(i)
= x(i-s) (*) x(i-r), where (*) is either of +, -, xor with or without
carry. |
| inversive_congruential (Hellekalek 1995) | int | good | slow | 1 word | no | x(i+1) = a x(i)-1 + c. Good equidistribution in several dimensions. Provides no apparent advantage compared to ranlux; the latter can produce floating-point numbers directly. |
| additive_combine (L'Ecuyer 1988) | int | good | medium | 2 words | yes | Combines two linear congruential generators. Same principle of
combination as xor_combine , i.e. z(i) = x(i) (*) y(i),
where (*) is one of +, -, xor. |
| R250 (Kirkpatrick and Stoll) | int | bad | fast | ~ 20 words | no | General Feedback Shift Register with two taps: Easily exploitable correlation. |
| linear_feedback_shift | int | medium | fast | 1 word | no | cycle length is limited to the maximum value representable in one machine word, fails some statistical tests, can be improved with the xor_combine compound engine. |
The GNU Scientific Library and Swarm have additional engine that are not mentioned in the table below.
| Engine | this proposal | CLHEP | crng | GNU Scientific Library | Swarm | Numerical Recipes | Knuth |
|---|---|---|---|---|---|---|---|
| LCG(231-1, 16807) | minstd_rand0 | - | ParkMiller | ran0, minstd | - | ran0 | p106, table 1, line 19 |
| LCG(232, a=1664525, c=1013904223) | linear_congruential< ..., 1664525,<PHONE_NUMBER>, (1 << 32) > | - | - | - | LCG1gen | - | p106, table 1, line 16 |
| LCG1 + LCG2 + LCG3 | - | - | WichmannHill | - | - | - | - |
| (LCG1 - LCG2 + LCG3 - LCG4) mod m0 | - | - | - | - | C4LCGXgen | - | - |
| LCG(231-1, 16807) with Bays/Durham shuffle | shuffle_output<minstd_rand0, 32> (shuffle_output not in this proposal) | - | - | ran1 | PMMLCG1gen | ran1 | Algorithm "B" |
| (LCG(231-85, 40014) + LCG(231-249, 40692)) mod 231-85 | ecuyer1988 (additive_combine not in this proposal) | Ranecu | LEcuyer | - | C2LCGXgen | - | - |
| (LCG(231-85, 40014) with Bays/Durham shuffle + LCG(231-249, 40692)) mod 231-85 | additive_combine< shuffle_output< linear_congruential<int, 40014, 0,<PHONE_NUMBER>>, 32>, linear_congruential<int, 40692, 0,<PHONE_NUMBER>> > (additive_combine and shuffle_output not in this proposal) |
- | - | ran2 | - | ran2 | - |
| X(i) = (X(i-55) - X(i-33)) mod 109 | - | - | - | ran3 | ~SCGgen | ran3 | - |
| X(i) = (X(i-100) - X(i-37)) mod 230 | - | - | - | - | - | - | ran_array |
| X(i) = (X(i-55) + X(i-24)) mod 232 | lagged_fibonacci< ..., 32, 55, 24, ...> (lagged_fibonacci not in this proposal) | - | - | - | ACGgen | - | - |
| DEShash(i,j) | - | - | - | - | - | ran4 | - |
| MT | mt19937 | MTwistEngine | MT19937 | mt19937 | MT19937gen | - | - |
| X(i) = (X(i-37) - X(i-24) - carry) mod 232 | subtract_with_carry< ..., (1<<32), 37, 24, ...> | - | - | - | SWB1gen | - | - |
| X(i) = (X(i-43) - X(i-22) - carry) mod 232-5 | subtract_with_carry< ..., (1<<32)-5, 43, 22, ...> | - | - | - | PSWBgen | - | - |
| RCARRY with block discard by Lüscher | discard_block< subtract_with_carry<...>, ...> | RanluxEngine, Ranlux64Engine | Ranlux | ranlx* | - | - | - |
| Hurd | - | Hurd160, Hurd288 | - | - | - | - | - |
| physical model by Ranshi | - | Ranshi | - | - | - | - | - |
| return predefined data | - | NonRandom | - | - | - | - | - |
| RANMAR: z(i) = (z(i-97) - z(i-33)) mod 224; y(i+1) = (y(i)-c) mod 224-3; X(i) = (z(i) - y(i)) mod 224 | additive_combine< lagged_fibonacci< (1<<24), 97, 33, ... >, linear_congruential< (1<<24)-3, 1, c, ...> (additive_combine and lagged_fibonacci not in this proposal) | JamesRandom | - | ranmar | - | - | - |
| Taus88 | taus88 = xor_combine ... | - | Taus88 | taus, taus2 | - | - | - |
| Taus60 | xor_combine< linear_feedback_shift< 31, 13, 12 >, 0, linear_feedback_shift< 29, 2, 4 >, 2, 0> (linear_feedback_shift not in this proposal) | - | - | - | C2TAUSgen | - | - |
| GFSR, 4-tap | - | - | - | gfsr4 | - | - | - |
| MRG32k3a | - | - | MRG32k3a | - | - | - | - |
| Distribution | this proposal | CLHEP | crng | GNU Scientific Library | Swarm | Numerical Recipes | Knuth |
|---|---|---|---|---|---|---|---|
| uniform (int) | uniform_int | - | - | - | UniformIntegerDist | - | - |
| uniform (float) | uniform_real | RandFlat | UniformDeviate | flat | UniformDoubleDist | - | uniform |
| exponential | exponential_distribution | RandExponential | ExponentialDeviate | exponential | ExponentialDist | exponential | exponential |
| normal | normal_distribution | RandGauss* | NormalDeviate | gaussian | NormalDist | normal (gaussian) | normal |
| lognormal | - | - | - | lognormal | LogNormalDist | - | - |
| gamma | gamma_distribution | RandGamma | GammaDeviate | gamma | GammaDist | gamma | gamma |
| beta | - | - | BetaDeviate | beta | - | - | beta |
| poisson | poisson_distribution | Poisson | PoissonDeviate | poisson | PoissonDist | poisson | poisson |
| binomial | binomial_distribution | RandBinomial | BinomialDeviate | binomial | - | binomial | binomial |
| geometric | geometric_distribution | - | GeometricDeviate | geometric | - | - | geometric |
| bernoulli | bernoulli_distribution | - | BernoulliDeviate | bernoulli | BernoulliDist | - | - |
| random bit | - | RandBit | - | - | RandomBitDist | - | - |
| breit-wigner | - | RandBreitWigner | - | - | - | - | - |
| chi-square | - | RandChiSquare | - | chisq | - | - | chi-square |
| landau | - | Landau | - | landau | - | - | - |
| F | - | - | - | F | - | - | F (variance-ratio) |
| t | - | - | - | t | - | - | t |
NumberGenerator ---- UniformRandomNumberGenerator ---- PseudoRandomNumberGenerator \--- RandomDistribution
This is considered an important feature for library implementors and serious users to check whether the provided library on the given platform returns the correct numbers. It could be argued that a library implementor should provide a correct implementation of some standard feature in any case.
No other library I have encountered provides explicit validation values in either their specification or their implementation, although some of them claim to be widely portable.
Another design option for validation that was part of early drafts of
this proposal is moving the reference number (10000th value in the
sequence) from specification space to implementation space, thus providing
a validation(x)
static member function for each engine that
compares the hard-coded 10000th value of the sequence with some
user-provided value x
presumeably obtained by actually
invoking the random-number engine object 10000 times. Due to the
template-based design, this amounted to a "val" template value parameter
for each engine, and the validation(x)
function reduced to the
trivial comparison "val == x". Handling validation for floating-point
engines required more machinery, because template value parameters cannot
be of floating-point type. Also, from a conceptual perspective, it seemed
odd to demand a validation decision from the very entitiy which one wanted
to validate.
std::ostream
in textual form and recover it from an
appropriate std::istream
. Each engine specifies how its
internal state is represented. The specific algorithm of a distribution is
left implementation-defined, thus no specifics about the representation of
its internal state are given. A store operation must not affect the number
sequence produced. It is expected that such external storage happens rarely
as opposed to producing random numbers, thus no particular attention to
performance is paid.
Engines and distributions use the usual idioms of
operator<<
and operator>>
. If the
user needs additional processing before or after storage on non-volatile
media, there is always the option to use a temporary
std::stringstream
.
Distributions sometimes store values from their associated source of
random numbers across calls to their operator()
. For example,
a common method for generating normally distributed random numbers is to
retrieve two uniformly distributed random numbers and compute two normally
distributed random numbers out of them. In order to reset the
distribution's random number cache to a defined state, each distribution
has a reset
member function. It should be called on a
distribution whenever its associated engine is exchanged or restored.
shuffle_output
and discard_block
contain a base
engine by value, because compounding is not intended to be used by
reference to an existing (re-used) engine object.
The wrapper variate_generator
can store engines either by
value or by reference, explicitly chosen by the template parameters. This
allows to use references to a single engine in several
variate_generator
, but makes it explicit to the user that he
is responsible for the management of the lifetime of the engine.
The precise state-holding base data types for the various engines are
left implementation-defined, because engines are usually optimized for
binary integers with 32 bits of word size. The specification in this
proposal cannot foresee whether a 32 bit quantity on the machine is
available in C++ as short, int, long, or not at all. It is up to the
implementation to decide which data type fits best. The implementation is
required to document the choice of data type, so that users can
(non-portably) rely on the precise type, for example for further
computation. Should the ISO C99 extensions become part of ISO C++, the
implementation-defined types could be replaced by e.g.
int_least32_t
.
The method how to produce non-deterministic random numbers is considered
implementation-defined, because it inherently depends on the implementation
and possibly even on the runtime environment: Imagine a platform that has
operating system support for randomness collection, e.g. from user
keystrokes and Ethernet inter-packet arrival timing (Linux
/dev/random
does this). If, in some installation, access to
the operating system functions providing these services has been
restricted, the C++ non-deterministic random number engine has been
deprived of its randomness. An implementation is required to document how
it obtains the non-deterministic random numbers, because only then can
users' confidence in them grow. Confidence is of particular concern in the
area of cryptography.
The algorithms how to produce the various distributions are specified as implementation-defined, because there is a vast variety of algorithms known for each distribution. Each has a different trade-off in terms of speed, adaptation to recent computer architectures, and memory use. The implementation is required to document its choice so that the user can judge whether it is acceptable quality-wise.
min()
and max()
return the lower
and upper bounds of a UniformRandomNumberGenerator. This could be a
random-number engine or one of the uniform_int
and
uniform_real
distributions.
Those bounds are not specified to be tight, because for some engines,
the bounds depend on the seeds. The seed can be changed during the lifetime
of the engine object, while the values returned by min()
and
max()
are invariant. Therefore, min()
and
max()
must return conservative bounds that are independent of
the seed.
variate_generator
, after
extensive discussion with some members of the computing division of Fermi
National Accelerator Laboratory. User-written and library-provided engines
and distributions plug in to the manager class. The approach is remotely
similar to the locale design in the standard library, where (user-written)
facets plug in to the (library-provided) locale class.
Earlier versions of this propsoal made (potentially user-written) distributions directly visible to (some other) user that wants to get random numbers distributed accordingly ("client"), there was no additional management layer between the distribution and the client.
The following additional features could be provided by the management layer:
The ability to share engines is important. This proposal makes lifetime
management issues explicit by requiring pointer or reference types in the
template instantiation of variate_generator
if reference
semantics are desired. Without a management class, providing this features
is much more cumbersome and imposes additional burden on the programmers
that produce distributions. Alternatively, reference semantics could always
be used, but this is an error-prone approach due to the lack of a standard
reference-counted smart pointer. I believe it is impossible to add a
reference-counted sharing mechanism in a manager-class-free design without
giving its precise type. And that would certainly conflict in semantic
scope with a smart pointer that will get into the standard eventually.
The management layer allows for a few common features to be factored out, in particular access to the engine and some member typedefs.
Comparison of other differing features between manager and non-manager designs:
variate_generator
as a an argument to a
function, the design in this proposal allows selecting only those
function signatures during overload resolution that are intended to be
called with a variate_generator
. In contrast, misbehaviour
is possible without a manager class, similar to iterators in function
signatures: template<class BiIter> void f(BiIter it)
matches f(5)
, without regard to the bidirectional iterator
requirements. An error then happens when instantiating f. The situation
worsens when several competing function templates are available and the
wrong one is chosen accidentally.variate_generator
template only. However, optimizations by
specialization for the engine/adaptor combination are perceived to
possibly have high benefit, while those for the (engine+adaptor) /
distribution combination are presumed to be much less beneficial.operator()(T x)
forwarding function.class unique_seed; template<class Engine> Engine seed(unique_seed&);The "seed" function retrieves some unique seed from the unique_seed class and then uses the
seed(first, last)
interface of an engine
to implant that unique seed. Specific seeding requirements for some engine
can be met by (partial) template specialization.
variate_generator
as the engine. The
variate_generator
will only apply automatic adaptations if the
output type of the engine is integers and the input type for the
distribution is floating-point or vice versa.
This subclause defines a facility for generating random numbers.
In the following table, X
denotes a number generator class
returning objects of type T
, and u
is a (possibly
const
) value of X
.
| Number generator requirements (in addition to function object) | |||
|---|---|---|---|
| expression | return type | pre/post-condition | complexity |
X::result_type |
T | std::numeric_limits<T>::is_specialized is
true |
compile-time |
In the following table, X
denotes a uniform random number
generator class returning objects of type T
, u
is
a value of X
and v
is a (possibly
const
) value of X
.
| Uniform random number generator requirements (in addition to number generator) | |||
|---|---|---|---|
| expression | return type | pre/post-condition | complexity |
u() |
T | - | amortized constant |
v.min() |
T |
Returns some l where l is less than or equal to all values
potentially returned by operator() . The return value of
this function shall not change during the lifetime of
v . |
constant |
v.max() |
T |
If std::numeric_limits<T>::is_integer , returns l
where l is less than or equal to all values potentially returned by
operator() , otherwise, returns l where l is strictly less
than all values potentially returned by operator() . In any
case, the return value of this function shall not change during the
lifetime of v . |
constant |
In the following table, X
denotes a pseudo-random number
engine class returning objects of type T
, t
is a
value of T
, u
is a value of X
,
v
is an lvalue of X
, it1
is an
lvalue and it2
is a (possibly const
) value of an
input iterator type It
having an unsigned integral value type,
x
, y
are (possibly const
) values of
X
, os
is convertible to an lvalue of type
std::ostream
, and is
is convertible to an lvalue
of type std::istream
.
A pseudo-random number engine x has a state x(i) at any given time. The
specification of each pseudo-random number engines defines the size of its
state in multiples of the size of its result_type
, given as an
integral constant expression.
Pseudo-random number engine requirements
(in addition to uniform random number generator,
CopyConstructible , and Assignable ) |
|||
|---|---|---|---|
| expression | return type | pre/post-condition | complexity |
X() |
- | creates an engine with the same initial state as all other
default-constructed engines of type X in the program. |
O(size of state) |
X(it1, it2) |
- | creates an engine with the initial state given by the range
[it1,it2) . it1 is advanced by the size of
state. If the size of the range [it1,it2) is insufficient, leaves
it1 == it2 and throws invalid_argument . |
O(size of state) |
u.seed() |
void | post: u == X() |
O(size of state) |
u.seed(it1, it2) |
void | post: If there are sufficiently many values in [it1, it2) to
initialize the state of u , then u ==
X(it1,it2) . Otherwise, it1 == it2 , throws
invalid_argument , and further use of u
(except destruction) is undefined until a seed member
function has been executed without throwing an exception. |
O(size of state) |
u() |
T |
given the state u(i) of the engine, computes u(i+1), sets the state to u(i+1), and returns some output dependent on u(i+1) | amortized constant |
x == y |
bool |
== is an equivalence relation. The current state x(i)
of x is equal to the current state y(j) of y. |
O(size of state) |
x != y |
bool |
!(x == y) |
O(size of state) |
os << x |
std::ostream& |
writes the textual representation of the state x(i) of
x to os , with
os.fmtflags set to
ios_base::dec|ios_base::fixed|ios_base::left and the fill
character set to the space character. In the output, adjacent numbers
are separated by one or more space characters.post: The os.fmtflags and fill character are
unchanged. |
O(size of state) |
is >> v |
std::istream& |
sets the state v(i) of v as determined by reading its
textual representation from is .post: The is.fmtflags are unchanged. |
O(size of state) |
In the following table, X
denotes a random distribution
class returning objects of type T
, u
is a value
of X
, x
is a (possibly const) value of
X
, and e
is an lvalue of an arbitrary type that
meets the requirements of a uniform random number generator, returning
values of type U
.
Random distribution requirements (in
addition to number generator, CopyConstructible , and
Assignable ) |
|||
|---|---|---|---|
| expression | return type | pre/post-condition | complexity |
X::input_type |
U | - | compile-time |
u.reset() |
void |
subsequent uses of u do not depend on values produced
by e prior to invoking reset . |
constant |
u(e) |
T |
the sequence of numbers returned by successive invocations with the
same object e is randomly distributed with some
probability density function p(x) |
amortized constant number of invocations of e |
os << x |
std::ostream& |
writes a textual representation for the parameters and additional
internal data of the distribution x to
os .post: The os.fmtflags and fill character are
unchanged. |
O(size of state) |
is >> u |
std::istream& |
restores the parameters and additional internal data of the
distribution u .pre: is provides a textual representation that was
previously written by operator<< post: The is.fmtflags are unchanged. |
O(size of state) |
Additional requirements: The sequence of numbers produced by repeated
invocations of x(e)
does not change whether or not os
<< x
is invoked between any of the invocations
x(e)
. If a textual representation is written using os
<< x
and that representation is restored into the same or a
different object y
of the same type using is >>
y
, repeated invocations of y(e)
produce the same
sequence of random numbers as would repeated invocations of
x(e)
.
In the following subclauses, a template parameter named
UniformRandomNumberGenerator
shall denote a class that
satisfies all the requirements of a uniform random number generator.
Moreover, a template parameter named Distribution
shall denote
a type that satisfies all the requirements of a random distribution.
Furthermore, a template parameter named RealType
shall denote
a type that holds an approximation to a real number. This type shall meet
the requirements for a numeric type (26.1 [lib.numeric.requirements]), the
binary operators +, -, *, / shall be applicable to it, a conversion from
double
shall exist, and function signatures corresponding to
those for type double
in subclause 26.5 [lib.c.math] shall be
available by argument-dependent lookup (3.4.2 [basic.lookup.koenig]).
[Note: The built-in floating-point types float
and
double
meet these requirements.]
<random>
synopsisnamespace std { template<class UniformRandomNumberGenerator, class Distribution> class variate_generator; template<class IntType, IntType a, IntType c, IntType m> class linear_congruential; template<class UIntType, int w, int n, int m, int r, UIntType a, int u, int s, UIntType b, int t, UIntType c, int l> class mersenne_twister; template<class IntType, IntType m, int s, int r> class subtract_with_carry; template<class RealType, int w, int s, int r> class subtract_with_carry_01; template<class UniformRandomNumberGenerator, int p, int r> class discard_block; template<class UniformRandomNumberGenerator1, int s1, class UniformRandomNumberGenerator2, int s2> class xor_combine; class random_device; template<class IntType = int> class uniform_int; template<class RealType = double> class bernoulli_distribution; template<class IntType = int, class RealType = double> class geometric_distribution; template<class IntType = int, class RealType = double> class poisson_distribution; template<class IntType = int, class RealType = double> class binomial_distribution; template<class RealType = double> class uniform_real; template<class RealType = double> class exponential_distribution; template<class RealType = double> class normal_distribution; template<class RealType = double> class gamma_distribution; } // namespace std
variate_generator
variate_generator
produces random numbers, drawing randomness
from an underlying uniform random number generator and shaping the
distribution of the numbers corresponding to a distribution function.
template<class Engine, class Distribution> class variate_generator { public: typedef Engine engine_type; typedef /* implementation defined */ engine_value_type; typedef Distribution distribution_type; typedef typename Distribution::result_type result_type; variate_generator(engine_type eng, distribution_type d); result_type operator()(); template<class T> result_type operator()(T value); engine_value_type& engine(); const engine_value_type& engine() const; distribution_type& distribution(); const distribution_type& distribution() const; result_type min() const; result_type max() const; };The template argument for the parameter
Engine
shall be of
the form U
, U&
, or
U*
, where U
denotes a class that
satisfies all the requirements of a uniform random number generator. The
member engine_value_type
shall name U
.
Specializations of variate_generator
satisfy the
requirements of CopyConstructible. They also satisfy the requirements of
Assignable unless the template parameter Engine
is of the form
U&
.
The complexity of all functions specified in this section is constant. No function described in this section except the constructor throws an exception.
variate_generator(engine_type eng, distribution_type d)Effects: Constructs a
variate_generator
object with the associated uniform random number generator eng
and the associated random distribution d
.result_type operator()()Returns:
distribution()(e)
e
, se, is obtained from the
sequence of numbers produced by the associated uniform random number
generator eng
, seng, as follows: Consider the
values of numeric_limits<T>::is_integer
for
T
both Distribution::input_type
and
engine_value_type::result_type
. If the values for both types
are true
, then se is identical to seng.
Otherwise, if the values for both types are false
, then the
numbers in seng are divided by
engine().max()-engine().min()
to obtain the numbers in
se. Otherwise, if the value for
engine_value_type::result_type
is true
and the
value for Distribution::input_type
is false
, then
the numbers in seng are divided by
engine().max()-engine().min()+1
to obtain the numbers in
se. Otherwise, the mapping from seng to se
is implementation-defined. In all cases, an implicit conversion from
engine_value_type::result_type
to
Distribution::input_type
is performed. If such a conversion
does not exist, the program is ill-formed.
template<class T> result_type operator()(T value)Returns:
distribution()(e, value)
. For
the semantics of e
, see the description of
operator()()
.
engine_value_type& engine()Returns: A reference to the associated uniform random number generator.
const engine_value_type& engine() constReturns: A reference to the associated uniform random number generator.
distribution_type& distribution()Returns: A reference to the associated random distribution.
const distribution_type& distribution() constReturns: A reference to the associated random distribution.
result_type min() constPrecondition:
distribution().min()
is
well-formeddistribution().min()
result_type max() constPrecondition:
distribution().max()
is
well-formeddistribution().max()
The class templates specified in this section satisfy all the requirements of a pseudo-random number engine (given in tables in section x.x), except where specified otherwise. Descriptions are provided here only for operations on the engines that are not described in one of these tables or for operations where there is additional semantic information.
All members declared static const
in any of the following
class templates shall be defined in such a way that they are usable as
integral constant expressions.
linear_congruential
linear_congruential
engine produces random numbers using a
linear function x(i+1) := (a * x(i) + c) mod m.
namespace std { template<class IntType, IntType a, IntType c, IntType m> class linear_congruential { public: // types typedef IntType result_type; // parameter values static const IntType multiplier = a; static const IntType increment = c; static const IntType modulus = m; // constructors and member function explicit linear_congruential(IntType x0 = 1); template<class In> linear_congruential(In& first, In last); void seed(IntType x0 = 1); template<class In> void seed(In& first, In last); result_type min() const; result_type max() const; result_type operator()(); }; template<class IntType, IntType a, IntType c, IntType m> bool operator==(const linear_congruential<IntType, a, c, m>& x, const linear_congruential<IntType, a, c, m>& y); template<class IntType, IntType a, IntType c, IntType m> bool operator!=(const linear_congruential<IntType, a, c, m>& x, const linear_congruential<IntType, a, c, m>& y); template<class CharT, class traits, class IntType, IntType a, IntType c, IntType m> basic_ostream<CharT, traits>& operator<<(basic_ostream<CharT, traits>& os, const linear_congruential<IntType, a, c, m>& x); template<class CharT, class traits, class IntType, IntType a, IntType c, IntType m> basic_istream<CharT, traits>& operator>>(basic_istream<CharT, traits>& is, linear_congruential<IntType, a, c, m>& x); }The template parameter
IntType
shall denote an integral
type large enough to store values up to (m-1). If the template parameter
m
is 0, the behaviour is implementation-defined. Otherwise, the
template parameters a
and c
shall be less than m.
The size of the state x(i) is 1.
explicit linear_congruential(IntType x0 = 1)Requires:
c > 0 || (x0 % m) > 0
linear_congruential
engine with state x(0) := x0
mod m.
void seed(IntType x0 = 1)Requires:
c > 0 || (x0 % m) > 0
x0
mod m.
template<class In> linear_congruential(In& first, In last)Requires:
c > 0 || *first > 0
*first
mod m.*first
.
template<class CharT, class traits, class IntType, IntType a, IntType c, IntType m> basic_ostream<CharT, traits>& operator<<(basic_ostream<CharT, traits>& os, const linear_congruential<IntType, a, c, m>& x);Effects: Writes x(i) to
os
.
mersenne_twister
mersenne_twister
engine produces random numbers o(x(i)) using
the following computation, performed modulo 2w. um
is a value with only the upper w-r
bits set in its binary
representation. lm
is a value with only its lower
r
bits set in its binary representation. rshift is a
bitwise right shift with zero-valued bits appearing in the high bits of the
result. lshift is a bitwise left shift with zero-valued bits
appearing in the low bits of the result.
namespace std { template<class UIntType, int w, int n, int m, int r, UIntType a, int u, int s, UIntType b, int t, UIntType c, int l> class mersenne_twister { public: // types typedef UIntType result_type; // parameter values static const int word_size = w; static const int state_size = n; static const int shift_size = m; static const int mask_bits = r; static const UIntType parameter_a = a; static const int output_u = u; static const int output_s = s; static const UIntType output_b = b; static const int output_t = t; static const UIntType output_c = c; static const int output_l = l; // constructors and member function mersenne_twister(); explicit mersenne_twister(UIntType value); template<class In> mersenne_twister(In& first, In last); void seed(); void seed(UIntType value); template<class In> void seed(In& first, In last); result_type min() const; result_type max() const; result_type operator()(); }; template<class UIntType, int w, int n, int m, int r, UIntType a, int u, int s, UIntType b, int t, UIntType c, int l> bool operator==(const mersenne_twister<UIntType, w, n, m, r, a, u, s, b, t, c, l>& y, const mersenne_twister<UIntType, w, n, m, r, a, u, s, b, t, c, l>& x); template<class UIntType, int w, int n, int m, int r, UIntType a, int u, int s, UIntType b, int t, UIntType c, int l> bool operator!=(const mersenne_twister<UIntType, w, n, m, r, a, u, s, b, t, c, l>& y, const mersenne_twister<UIntType, w, n, m, r, a, u, s, b, t, c, l>& x); template<class CharT, class traits, class UIntType, int w, int n, int m, int r, UIntType a, int u, int s, UIntType b, int t, UIntType c, int l> basic_ostream<CharT, traits>& operator<<(basic_ostream<CharT, traits>& os, const mersenne_twister<UIntType, w, n, m, r, a, u, s, b, t, c, l>& x); template<class CharT, class traits, class UIntType, int w, int n, int m, int r, UIntType a, int u, int s, UIntType b, int t, UIntType c, int l> basic_istream<CharT, traits>& operator>>(basic_istream<CharT, traits>& is, mersenne_twister<UIntType, w, n, m, r, a, u, s, b, t, c, l>& x); }The template parameter
UIntType
shall denote an unsigned
integral type large enough to store values up to 2w-1. Also, the
following relations shall hold: 1<=m<=n. 0<=r,u,s,t,l<=w.
0<=a,b,c<=2w-1.
The size of the state x(i) is n
.
mersenne_twister()Effects: Constructs a
mersenne_twister
engine and invokes seed()
.
explicit mersenne_twister(result_type value)Effects: Constructs a
mersenne_twister
engine and invokes seed(value)
.
template<class In> mersenne_twister(In& first, In last)Effects: Constructs a
mersenne_twister
engine and invokes seed(first, last)
.
void seed()Effects: Invokes
seed(4357)
.
void seed(result_type value)Requires:
value > 0
value
, sets x(-n) ... x(-1) to
l(1) ... l(n), respectively.template<class In> void seed(In& first, In last)Effects: Given the values z0 ... zn-1 obtained by dereferencing [first, first+n), sets x(-n) ... x(-1) to z0 mod 2w ... zn-1 mod 2w.
n
dereferences of
first
.
template<class UIntType, int w, int n, int m, int r, UIntType a, int u, int s, UIntType b, int t, UIntType c, int l> bool operator==(const mersenne_twister<UIntType, w, n, m, r, a, u, s, b, t, c, l>& y, const mersenne_twister<UIntType, w, n, m, r, a, u, s, b, t, c, l>& x)Returns: x(i-n) == y(j-n) and ... and x(i-1) == y(j-1)
x
is
o(x(i)) and the next output of y
is o(y(j)).template<class CharT, class traits, class UIntType, int w, int n, int m, int r, UIntType a, int u, int s, UIntType b, int t, UIntType c, int l> basic_ostream<CharT, traits>& operator<<(basic_ostream<CharT, traits>& os, const mersenne_twister<UIntType, w, n, m, r, a, u, s, b, t, c, l>& x)Effects: Writes x(i-n), ... x(i-1) to
os
,
in that order.subtract_with_carry
subtract_with_carry
engine produces integer random numbers
using x(i) = (x(i-s) - x(i-r) - carry(i-1)) mod m; carry(i) = 1 if x(i-s) -
x(i-r) - carry(i-1) < 0, else carry(i) = 0.
namespace std { template<class IntType, IntType m, int s, int r> class subtract_with_carry { public: // types typedef IntType result_type; // parameter values static const IntType modulus = m; static const int long_lag = r; static const int short_lag = s; // constructors and member function subtract_with_carry(); explicit subtract_with_carry(IntType value); template<class In> subtract_with_carry(In& first, In last); void seed(IntType value = 19780503); template<class In> void seed(In& first, In last); result_type min() const; result_type max() const; result_type operator()(); }; template<class IntType, IntType m, int s, int r> bool operator==(const subtract_with_carry<IntType, m, s, r> & x, const subtract_with_carry<IntType, m, s, r> & y); template<class IntType, IntType m, int s, int r> bool operator!=(const subtract_with_carry<IntType, m, s, r> & x, const subtract_with_carry<IntType, m, s, r> & y); template<class CharT, class Traits, class IntType, IntType m, int s, int r> std::basic_ostream<CharT,Traits>& operator<<(std::basic_ostream<CharT,Traits>& os, const subtract_with_carry<IntType, m, s, r>& f); template<class CharT, class Traits, class IntType, IntType m, int s, int r> std::basic_istream<CharT,Traits>& operator>>(std::basic_istream<CharT,Traits>& is, subtract_with_carry<IntType, m, s, r>& f); }The template parameter
IntType
shall denote a signed
integral type large enough to store values up to m-1. The following relation
shall hold: 0<s<r. Let w the number of bits in the binary
representation of m.
The size of the state is r
.
subtract_with_carry()Effects: Constructs a
subtract_with_carry
engine and invokes seed()
.
explicit subtract_with_carry(IntType value)Effects: Constructs a
subtract_with_carry
engine and invokes seed(value)
.
template<class In> subtract_with_carry(In& first, In last)Effects: Constructs a
subtract_with_carry
engine and invokes seed(first, last)
.
void seed(IntType value = 19780503)Requires:
value > 0
value
, sets x(-r) ... x(-1) to l(1) mod m ...
l(r) mod m, respectively. If x(-1) == 0, sets carry(-1) = 1, else sets
carry(-1) = 0.template<class In> void seed(In& first, In last)Effects: With n=w/32+1 (rounded downward) and given the values z0 ... zn*r-1 obtained by dereferencing [first, first+n*r), sets x(-r) ... x(-1) to (z0 * 232 + ... + zn-1 * 232*(n-1)) mod m ... (z(r-1)*n * 232 + ... + zr-1 * 232*(n-1)) mod m. If x(-1) == 0, sets carry(-1) = 1, else sets carry(-1) = 0.
r*n
dereferences of
first
.
template<class IntType, IntType m, int s, int r> bool operator==(const subtract_with_carry<IntType, m, s, r> & x, const subtract_with_carry<IntType, m, s, r> & y)Returns: x(i-r) == y(j-r) and ... and x(i-1) == y(j-1).
x
is x(i)
and the next output of y
is y(j).template<class CharT, class Traits, class IntType, IntType m, int s, int r> std::basic_ostream<CharT,Traits>& operator<<(std::basic_ostream<CharT,Traits>& os, const subtract_with_carry<IntType, m, s, r>& f)Effects: Writes x(i-r) ... x(i-1), carry(i-1) to
os
, in that order.subtract_with_carry_01
subtract_with_carry_01
engine produces floating-point random
numbers using x(i) = (x(i-s) - x(i-r) - carry(i-1)) mod 1; carry(i) =
2-w if x(i-s) - x(i-r) - carry(i-1) < 0, else carry(i) = 0.
namespace std { template<class RealType, int w, int s, int r> class subtract_with_carry_01 { public: // types typedef RealType result_type; // parameter values static const int word_size = w; static const int long_lag = r; static const int short_lag = s; // constructors and member function subtract_with_carry_01(); explicit subtract_with_carry_01(unsigned int value); template<class In> subtract_with_carry_01(In& first, In last); void seed(unsigned int value = 19780503); template<class In> void seed(In& first, In last); result_type min() const; result_type max() const; result_type operator()(); }; template<class RealType, int w, int s, int r> bool operator==(const subtract_with_carry_01<RealType, w, s, r> x, const subtract_with_carry_01<RealType, w, s, r> y); template<class RealType, int w, int s, int r> bool operator!=(const subtract_with_carry_01<RealType, w, s, r> x, const subtract_with_carry_01<RealType, w, s, r> y); template<class CharT, class Traits, class RealType, int w, int s, int r> std::basic_ostream<CharT,Traits>& operator<<(std::basic_ostream<CharT,Traits>& os, const subtract_with_carry_01<RealType, w, s, r>& f); template<class CharT, class Traits, class RealType, int w, int s, int r> std::basic_istream<CharT,Traits>& operator>>(std::basic_istream<CharT,Traits>& is, subtract_with_carry_01<RealType, w, s, r>& f); }The following relation shall hold: 0<s<r.
The size of the state is r
.
subtract_with_carry_01()Effects: Constructs a
subtract_with_carry_01
engine and invokes seed()
.
explicit subtract_with_carry_01(unsigned int value)Effects: Constructs a
subtract_with_carry_01
engine and invokes
seed(value)
.
template<class In> subtract_with_carry_01(In& first, In last)Effects: Constructs a
subtract_with_carry_01
engine and invokes seed(first,
last)
.
void seed(unsigned int value = 19780503)Effects: With a linear congruential generator l(i) having parameters m =<PHONE_NUMBER>, a = 40014, c = 0, and l(0) =
value
, sets x(-r) ... x(-1) to (l(1)*2-w) mod 1 ...
(l(r)*2-w) mod 1, respectively. If x(-1) == 0, sets carry(-1) =
2-w, else sets carry(-1) = 0.template<class In> void seed(In& first, In last)Effects: With n=w/32+1 (rounded downward) and given the values z0 ... zn*r-1 obtained by dereferencing [first, first+n*r), sets x(-r) ... x(-1) to (z0 * 232 + ... + zn-1 * 232*(n-1)) * 2-w mod 1 ... (z(r-1)*n * 232 + ... + zr-1 * 232*(n-1)) * 2-w mod 1. If x(-1) == 0, sets carry(-1) = 2-w, else sets carry(-1) = 0.
template<class RealType, int w, int s, int r> bool operator==(const subtract_with_carry<RealType, w, s, r> x, const subtract_with_carry<RealType, w, s, r> y);Returns: true, if and only if x(i-r) == y(j-r) and ... and x(i-1) == y(j-1).
template<class CharT, class Traits, class RealType, int w, int s, int r> std::basic_ostream<CharT,Traits>& operator<<(std::basic_ostream<CharT,Traits>& os, const subtract_with_carry<RealType, w, s, r>& f);Effects: Write x(i-r)*2w ... x(i-1)*2w, carry(i-1)*2w to
os
, in that
order.discard_block
discard_block
engine produces random numbers from some base
engine by discarding blocks of data.
namespace std { template<class UniformRandomNumberGenerator, int p, int r> class discard_block { public: // types typedef UniformRandomNumberGenerator base_type; typedef typename base_type::result_type result_type; // parameter values static const int block_size = p; static const int used_block = r; // constructors and member function discard_block(); explicit discard_block(const base_type & rng); template<class In> discard_block(In& first, In last); void seed(); template<class In> void seed(In& first, In last); const base_type& base() const; result_type min() const; result_type max() const; result_type operator()(); private: // base_type b; exposition only // int n; exposition only }; template<class UniformRandomNumberGenerator, int p, int r> bool operator==(const discard_block<UniformRandomNumberGenerator,p,r> & x, (const discard_block<UniformRandomNumberGenerator,p,r> & y); template<class UniformRandomNumberGenerator, int p, int r, typename UniformRandomNumberGenerator::result_type val> bool operator!=(const discard_block<UniformRandomNumberGenerator,p,r> & x, (const discard_block<UniformRandomNumberGenerator,p,r> & y); template<class CharT, class traits, class UniformRandomNumberGenerator, int p, int r> basic_ostream<CharT, traits>& operator<<(basic_ostream<CharT, traits>& os, const discard_block<UniformRandomNumberGenerator,p,r> & x); template<class CharT, class traits, class UniformRandomNumberGenerator, int p, int r> basic_istream<CharT, traits>& operator>>(basic_istream<CharT, traits>& is, discard_block<UniformRandomNumberGenerator,p,r> & x); }The template parameter
UniformRandomNumberGenerator
shall
denote a class that satisfies all the requirements of a uniform random number
generator, given in tables in section x.x. r <= p. The size of the state
is the size of b
plus 1.
discard_block()Effects: Constructs a
discard_block
engine. To construct the subobject b, invokes its default
constructor. Sets n = 0
.
explicit discard_block(const base_type & rng)Effects: Constructs a
discard_block
engine. Initializes b with a copy of rng
. Sets n
= 0
.
template<class In> discard_block(In& first, In last)Effects: Constructs a
discard_block
engine. To construct the subobject b, invokes the b(first,
last)
constructor. Sets n = 0
.
void seed()Effects: Invokes
b.seed()
and
sets n = 0
.
template<class In> void seed(In& first, In last)Effects: Invokes
b.seed(first,
last)
and sets n = 0
.
const base_type& base() constReturns: b
result_type operator()()Effects: If n >= r, invokes
b
(p-r) times, discards the values returned, and sets
n = 0
. In any case, then increments n
and returns
b()
.
template<class CharT, class traits, class UniformRandomNumberGenerator, int p, int r> basic_ostream<CharT, traits>& operator<<(basic_ostream<CharT, traits>& os, const discard_block<UniformRandomNumberGenerator,p,r> & x);Effects: Writes
b
, then
n
to os
.
xor_combine
xor_combine
engine produces random numbers from two integer base engines by merging
their random values with bitwise exclusive-or.
namespace std { template<class UniformRandomNumberGenerator1, int s1, class UniformRandomNumberGenerator2, int s2> class xor_combine { public: // types typedef UniformRandomNumberGenerator1 base1_type; typedef UniformRandomNumberGenerator2 base2_type; typedef typename base_type::result_type result_type; // parameter values static const int shift1 = s1; static const int shift2 = s2; // constructors and member function xor_combine(); xor_combine(const base1_type & rng1, const base2_type & rng2); template<class In> xor_combine(In& first, In last); void seed(); template<class In> void seed(In& first, In last); const base1_type& base1() const; const base2_type& base2() const; result_type min() const; result_type max() const; result_type operator()(); private: // base1_type b1; exposition only // base2_type b2; exposition only }; template<class UniformRandomNumberGenerator1, int s1, class UniformRandomNumberGenerator2, int s2> bool operator==(const xor_combine<UniformRandomNumberGenerator1, s1, UniformRandomNumberGenerator2, s2> & x, (const xor_combine<UniformRandomNumberGenerator1, s1, UniformRandomNumberGenerator2, s2> & y); template<class UniformRandomNumberGenerator1, int s1, class UniformRandomNumberGenerator2, int s2> bool operator!=(const xor_combine<UniformRandomNumberGenerator1, s1, UniformRandomNumberGenerator2, s2> & x, (const xor_combine<UniformRandomNumberGenerator1, s1, UniformRandomNumberGenerator2, s2> & y); template<class CharT, class traits, class UniformRandomNumberGenerator1, int s1, class UniformRandomNumberGenerator2, int s2> basic_ostream<CharT, traits>& operator<<(basic_ostream<CharT, traits>& os, const xor_combine<UniformRandomNumberGenerator1, s1, UniformRandomNumberGenerator2, s2> & x); template<class CharT, class traits, class UniformRandomNumberGenerator1, int s1, class UniformRandomNumberGenerator2, int s2> basic_istream<CharT, traits>& operator>>(basic_istream<CharT, traits>& is, xor_combine<UniformRandomNumberGenerator1, s1, UniformRandomNumberGenerator2, s2> & x); }The template parameters
UniformRandomNumberGenerator1
and
UniformRandomNumberGenerator1
shall denote classes that satisfy
all the requirements of a uniform random number generator, given in tables in
section x.x . The size of the state is the size of b1
plus the size of b2
.
xor_combine()Effects: Constructs a
xor_combine
engine.
To construct each of the subobjects b1 and b2, invokes
their respective default constructors.
xor_combine(const base1_type & rng1, const base2_type & rng2)Effects: Constructs a
xor_combine
engine.
Initializes b1 with a copy of rng1
and b2 with
a copy of rng2
.
template<class In> xor_combine(In& first, In last)Effects: Constructs a
xor_combine
engine.
To construct the subobject b1, invokes the b1(first,
last)
constructor. Then, to construct the subobject b2,
invokes the b2(first, last)
constructor.
void seed()Effects: Invokes
b1.seed()
and
b2.seed()
.
template<class In> void seed(In& first, In last)Effects: Invokes
b1.seed(first,
last)
, then invokes b2.seed(first, last)
.
const base1_type& base1() constReturns: b1
const base2_type& base2() constReturns: b2
result_type operator()()Returns: (
b1() << s1) ^
(b2() << s2)
.
template<class CharT, class traits, class UniformRandomNumberGenerator1, int s1, class UniformRandomNumberGenerator2, int s2> basic_ostream<CharT, traits>& operator<<(basic_ostream<CharT, traits>& os, const xor_combine<UniformRandomNumberGenerator1, s1, UniformRandomNumberGenerator2, s2> & x);Effects: Writes
b1
, then
b2
to os
.
namespace std { typedef linear_congruential</* implementation defined */, 16807, 0,<PHONE_NUMBER>> minstd_rand0; typedef linear_congruential</* implementation defined */, 48271, 0,<PHONE_NUMBER>> minstd_rand; typedef mersenne_twister</* implementation defined */,32,624,397,31,0x9908b0df,11,7,0x9d2c5680,15,0xefc60000,18> mt19937; typedef subtract_with_carry_01<float, 24, 10, 24> ranlux_base_01; typedef subtract_with_carry_01<double, 48, 10, 24> ranlux64_base_01; typedef discard_block<subtract_with_carry</* implementation defined */, (1<<24), 10, 24>, 223, 24> ranlux3; typedef discard_block<subtract_with_carry</* implementation defined */, (1<<24), 10, 24>, 389, 24> ranlux4; typedef discard_block<subtract_with_carry_01<float, 24, 10, 24>, 223, 24> ranlux3_01; typedef discard_block<subtract_with_carry_01<float, 24, 10, 24>, 389, 24> ranlux4_01; }For a default-constructed
minstd_rand0
object, x(10000) =
1043618065. For a default-constructed minstd_rand
object,
x(10000) = 399268537.
For a default-constructed mt19937
object, x(10000) =
3346425566.
For a default-constructed ranlux3
object, x(10000) =
5957620. For a default-constructed ranlux4
object, x(10000) =
8587295. For a default-constructed ranlux3_01
object, x(10000)
= 5957620 * 2-24. For a default-constructed
ranlux4_01
object, x(10000) = 8587295 * 2-24.
random_device
random_device
produces non-deterministic random numbers. It satisfies all the
requirements of a uniform random number generator (given in tables in
section x.x). Descriptions are provided here only for operations on the
engines that are not described in one of these tables or for operations
where there is additional semantic information.
If implementation limitations prevent generating non-deterministic random numbers, the implementation can employ a pseudo-random number engine.
namespace std { class random_device { public: // types typedef unsigned int result_type; // constructors, destructors and member functions explicit random_device(const std::string& token = /* implementation-defined */); result_type min() const; result_type max() const; double entropy() const; result_type operator()(); private: random_device(const random_device& ); void operator=(const random_device& ); }; }
explicit random_device(const std::string& token = /* implementation-defined */)Effects: Constructs a
random_device
non-deterministic random number engine. The semantics and default value of
the token
parameter are implementation-defined. [Footnote: The
parameter is intended to allow an implementation to differentiate between
different sources of randomness.]exception
if the random_device
could not be
initialized.
result_type min() constReturns:
numeric_limits<result_type>::min()
result_type max() constReturns:
numeric_limits<result_type>::max()
double entropy() constReturns: An entropy estimate for the random numbers returned by operator(), in the range
min()
to log2(
max()
+1). A deterministic random number generator (e.g. a
pseudo-random number engine) has entropy 0.result_type operator()()Returns: A non-deterministic random value, uniformly distributed between
min()
and max()
, inclusive. It
is implementation-defined how these values are generated.exception
if a random number could not be obtained.
A template parameter named IntType
shall denote a type that
represents an integer number. This type shall meet the requirements for a
numeric type (26.1 [lib.numeric.requirements]), the binary operators +, -,
*, /, % shall be applicable to it, and a conversion from int
shall exist. [Footnote: The built-in types int
and
long
meet these requirements.]
Given an object whose type is specified in this subclause, if the lifetime of the uniform random number generator referred to in the constructor invocation for that object has ended, any use of that object is undefined.
No function described in this section throws an exception, unless an
operation on values of IntType
or RealType
throws
an exception. [Note: Then, the effects are undefined, see
[lib.numeric.requirements]. ]
The algorithms for producing each of the specified distributions are implementation-defined.
uniform_int
uniform_int
random distribution produces integer random numbers x in the range min
<= x <= max, with equal probability. min and max are the parameters
of the distribution.
A uniform_int
random distribution satisfies all the
requirements of a uniform random number generator (given in tables in
section x.x).
namespace std { template<class IntType = int> class uniform_int { public: // types typedef IntType input_type; typedef IntType result_type; // constructors and member function explicit uniform_int(IntType min = 0, IntType max = 9); result_type min() const; result_type max() const; void reset(); template<class UniformRandomNumberGenerator> result_type operator()(UniformRandomNumberGenerator& urng); template<class UniformRandomNumberGenerator> result_type operator()(UniformRandomNumberGenerator& urng, result_type n); }; }
uniform_int(IntType min = 0, IntType max = 9)Requires: min <= max
uniform_int
object.
min
and max
are the parameters of the
distribution.
result_type min() constReturns: The "min" parameter of the distribution.
result_type max() constReturns: The "max" parameter of the distribution.
result_type operator()(UniformRandomNumberGenerator& urng, result_type n)Returns: A uniform random number x in the range 0 <= x < n. [Note: This allows a
variate_generator
object with a uniform_int
distribution to be used with
std::random_shuffe, see [lib.alg.random.shuffle]. ]
bernoulli_distribution
bernoulli_distribution
random distribution produces
bool
values distributed with probabilities p(true) = p and
p(false) = 1-p. p is the parameter of the distribution.
namespace std { template<class RealType = double> class bernoulli_distribution { public: // types typedef int input_type; typedef bool result_type; // constructors and member function explicit bernoulli_distribution(const RealType& p = RealType(0.5)); RealType p() const; void reset(); template<class UniformRandomNumberGenerator> result_type operator()(UniformRandomNumberGenerator& urng); }; }
bernoulli_distribution(const RealType& p = RealType(0.5))Requires: 0 <= p <= 1
bernoulli_distribution
object. p
is the parameter of the distribution.
RealType p() constReturns: The "p" parameter of the distribution.
geometric_distribution
geometric_distribution
random distribution produces integer
values i >= 1 with p(i) = (1-p) * pi-1. p is the
parameter of the distribution.
namespace std { template<class IntType = int, class RealType = double> class geometric_distribution { public: // types typedef RealType input_type; typedef IntType result_type; // constructors and member function explicit geometric_distribution(const RealType& p = RealType(0.5)); RealType p() const; void reset(); template<class UniformRandomNumberGenerator> result_type operator()(UniformRandomNumberGenerator& urng); }; }
geometric_distribution(const RealType& p = RealType(0.5))Requires: 0 < p < 1
geometric_distribution
object; p
is the parameter of the distribution.
RealType p() constReturns: The "p" parameter of the distribution.
poisson_distribution
poisson_distribution
random distribution produces integer
values i >= 0 with p(i) = exp(-mean) * meani / i!.
mean is the parameter of the distribution.
namespace std { template<class IntType = int, class RealType = double> class poisson_distribution { public: // types typedef RealType input_type; typedef IntType result_type; // constructors and member function explicit poisson_distribution(const RealType& mean = RealType(1)); RealType mean() const; void reset(); template<class UniformRandomNumberGenerator> result_type operator()(UniformRandomNumberGenerator& urng); }; }
poisson_distribution(const RealType& mean = RealType(1))Requires: mean > 0
poisson_distribution
object; mean
is the parameter of the distribution.
RealType mean() constReturns: The "mean" parameter of the distribution.
binomial_distribution
binomial_distribution
random distribution produces integer
values i >= 0 with p(i) = (n over i) * pi *
(1-p)t-i. t and p are the parameters of the distribution.
namespace std { template<class IntType = int, class RealType = double> class binomial_distribution { public: // types typedef /* implementation-defined */ input_type; typedef IntType result_type; // constructors and member function explicit binomial_distribution(IntType t = 1, const RealType& p = RealType(0.5)); IntType t() const; RealType p() const; void reset(); template<class UniformRandomNumberGenerator> result_type operator()(UniformRandomNumberGenerator& urng); }; }
binomial_distribution(IntType t = 1, const RealType& p = RealType(0.5))Requires: 0 <= p <= 1 and t >= 0
binomial_distribution
object; t
and p
are the parameters of the
distribution.
IntType t() constReturns: The "t" parameter of the distribution.
RealType p() constReturns: The "p" parameter of the distribution.
uniform_real
uniform_real
random distribution produces floating-point
random numbers x in the range min <= x <= max, with equal
probability. min and max are the parameters of the distribution.
A uniform_real
random distribution satisfies all the
requirements of a uniform random number generator (given in tables in
section x.x).
namespace std { template<class RealType = double> class uniform_real { public: // types typedef RealType input_type; typedef RealType result_type; // constructors and member function explicit uniform_real(RealType min = RealType(0), RealType max = RealType(1)); result_type min() const; result_type max() const; void reset(); template<class UniformRandomNumberGenerator> result_type operator()(UniformRandomNumberGenerator& urng); }; }
uniform_real(RealType min = RealType(0), RealType max = RealType(1))Requires: min <= max
uniform_real
object;
min
and max
are the parameters of the
distribution.
result_type min() constReturns: The "min" parameter of the distribution.
result_type max() constReturns: The "max" parameter of the distribution.
exponential_distribution
exponential_distribution
random distribution produces random
numbers x > 0 distributed with probability density function p(x) =
lambda * exp(-lambda * x), where lambda is the parameter of the
distribution.
namespace std { template<class RealType = double> class exponential_distribution { public: // types typedef RealType input_type; typedef RealType result_type; // constructors and member function explicit exponential_distribution(const result_type& lambda = result_type(1)); RealType lambda() const; void reset(); template<class UniformRandomNumberGenerator> result_type operator()(UniformRandomNumberGenerator& urng); }; }
exponential_distribution(const result_type& lambda = result_type(1))Requires: lambda > 0
exponential_distribution
object with rng
as the
reference to the underlying source of random numbers. lambda
is the parameter for the distribution.
RealType lambda() constReturns: The "lambda" parameter of the distribution.
normal_distribution
normal_distribution
random distribution produces random
numbers x distributed with probability density function p(x) =
1/sqrt(2*pi*sigma) * exp(- (x-mean)2 / (2*sigma2) ),
where mean and sigma are the parameters of the distribution.
namespace std { template<class RealType = double> class normal_distribution { public: // types typedef RealType input_type; typedef RealType result_type; // constructors and member function explicit normal_distribution(base_type & rng, const result_type& mean = 0, const result_type& sigma = 1); RealType mean() const; RealType sigma() const; void reset(); template<class UniformRandomNumberGenerator> result_type operator()(UniformRandomNumberGenerator& urng); }; }
explicit normal_distribution( const result_type& mean = 0, const result_type& sigma = 1);Requires: sigma > 0
normal_distribution
object; mean
and sigma
are the parameters for the
distribution.
RealType mean() constReturns: The "mean" parameter of the distribution.
RealType sigma() constReturns: The "sigma" parameter of the distribution.
gamma_distribution
gamma_distribution
random distribution produces random numbers
x distributed with probability density function p(x) = 1/Gamma(alpha) *
xalpha-1 * exp(-x), where alpha is the parameter of the
distribution.
namespace std { template<class RealType = double> class gamma_distribution { public: // types typedef RealType input_type; typedef RealType result_type; // constructors and member function explicit gamma_distribution(const result_type& alpha = result_type(1)); RealType alpha() const; void reset(); template<class UniformRandomNumberGenerator> result_type operator()(UniformRandomNumberGenerator& urng); }; }
explicit gamma_distribution(const result_type& alpha = result_type(1));Requires: alpha > 0
gamma_distribution
object; alpha
is the parameter for the distribution.
RealType alpha() constReturns: The "alpha" parameter of the distribution.
Revised 05 December, 2006
Copyright © 2002 Jens Maurer
Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)


WITNESS LIST Oversight of Electric Utility Restructuring Committee June 18, 2002 - 9:30A Progress of Transition to a Retail ON: Adib, Parviz Director, Market Oversight (PUCT), Austin, TX Durso, Susan Attorney (PUCT), Austin, TX Eddleman, Neil V.P. ExoLink Corporation (ExoLink Corporation), Lewisville, TX Greene, Mike Chairman (ERCOT Board), Dallas, TX Griffey, Charles V.P. Regulatory (Reliant Resources), Houston, TX Huddleston, Barry Sr. Director, Market Structure (Dynegy Inc.), Houston, TX Jones, Monte (ERCOT), Dallas, TX Klein, Becky Chairman (PUCT), Austin, TX Mueller, Keith (Accenture LLP), Reston, VA Noel, Thomas (ERCOT), Austin, TX Perlman, Brett Commissioner (PUCT), Austin, TX Ponder, Steve (FPL Energy LLC), Sacramento, CA Stout, John Sr. V.P. Wholesale Energy (Reliant Resources), Houston, TX


LessSimpleGrid (LSG) is not next Bootstrap or Foundation, but something I need. While we human beings were born as unique entity, there's chance we share same taste so why don't share?
By "less" it means that this thing is a) built with less, b) not as simple as Simple-Grid, the original repository this's forked from, but still being simple.
Psst this is also inspired heavily by Kraken.Scale well. All columns will adjust to new line on narrow screen.
KISS.
It will take available width in glory!
Combine with offset, easy layout design.

.text-left

.text-center

.text-right

.float-left

.float-right

.float-center
will conquer whole grid! If you want to center a column safely, use offset)

.float-center

.space-top

.space-bottom

Will not appear on mobile.

Will appear on mobile only.

col-1-4

col-1-4

col-1-4

col-1-4

col-4-12

col-8-12

.col-3-12 .off-4-12

.col-2-12 .off-3-12


Blog Archive 2011 My TV spot on PBS Dec 20 2011 Textmate 2 Alpha is great Dec 20 2011 Clear water in Northwest Montana Dec 20 2011 YouTube hits 1,000,000,000,000 playbacks in 2011 Dec 20 2011 Very cool Facebook timelines Dec 20 2011 Sweet photo of a sleeping dog Nov 13 2011 Google Reader and Mac/iOS RSS readers that sync Oct 25 2011 Canon EOS-1D X first hands-on (video) Oct 25 2011 Trick shot basketball frisbee competition Oct 22 2011 Star Wars meets Pulp Fiction Oct 22 2011 Sick rendition of Zeppelin by Michael Winslow Oct 22 2011 Japanese girl explains Star Wars Oct 22 2011 MarkdownPad editor for Windows Oct 21 2011 Android Face Login Oct 19 2011 Jekyll bootstrap Oct 17 2011 Learn How to make Angry Birds (co.uk) Oct 16 2011 First thoughts on Siri Oct 15 2011 Faceshift Oct 08 2011 Doggy AT-AT Oct 08 2011 Steve Jobs Succumbs to Alternative Medicine Oct 06 2011 Bell & Ross shuts down its website in honor of Jobs Oct 06 2011 Transfer Cutting Board Oct 05 2011 Removal of Italian Wikipedia Oct 05 2011 A Fried Slice Of Heaven: Americas Favorite Bacon Dishes Oct 05 2011 Amazon adds server-side encryption to S3 data service Oct 05 2011 Dropbox is my publish button Oct 04 2011 Growl 1.3 now available on the Mac App Store Oct 03 2011 Overview of Text Editors for Programming on the Mac Oct 02 2011 My rating for the movie Drive Oct 02 2011 Mou - new markdown editor for the Mac Oct 02 2011 Jobs was livid over native Facebook on HP Oct 02 2011 Video: A Look At The Fastest Chronograph Watch Ever Made Oct 01 2011 Statistics Prove Women are Worse at Parking Oct 01 2011 Estimate: Amazon Kindle Fire sold at $10 loss to build share Oct 01 2011 Infographic: Top iPhone 5 Rumors Sep 30 2011 I need one of these Sep 30 2011 First Looks: JH Audio JH16 Pro Custom In-Ear Monitor Sep 30 2011 Baby pandas need a nap (photo) Sep 30 2011 Using Octopress & Jekyll with MarsEdit Sep 30 2011 Gorgeous 911 on a cliff Sep 30 2011 PBS reporter jailed while covering protests in NYC Sep 30 2011 Bell & Ross Harley Is Amazing Sep 28 2011 Amazon Route 53 to Host Your DNS Sep 27 2011 Great Loo & Placido mashup Sep 26 2011 A Fantastic Dubstep Dance Routine Sep 26 2011 Dubstep in a Cereal Commercial Sep 25 2011 Porn Stars and Google Plus Sep 25 2011 Puberty Sep 25 2011 Tig Notaro Is My New Favorite Comedian Sep 24 2011 Crazy Russian Firing Minigun Sep 24 2011 I Think This Fan Impressed His Date Sep 24 2011 HP Board is the worst ever Sep 22 2011 Gunpoint Game Sep 22 2011 Some Great OSX Hacks via the Command Line Sep 20 2011 10 Fatest States in America Sep 20 2011 Wheelmate Laptop Steering Wheel Desk Sep 19 2011 This Keyboard Is Super Comfortable Sep 19 2011 Site2Pic Creates Website Screenshots Sep 19 2011 Container Ship Delivering Cranes Sep 18 2011 Really Cool New Keyboard From Corsair Sep 17 2011 David Blaine Explains How He Holds His Breath for 17 Minutes Sep 17 2011 Now This Is How You Fly Sep 17 2011 Jedi Kittens. Enough Said. Sep 16 2011 An Amazing Photo Gallery of North Korea Sep 16 2011 Sick Downhill Ride From Danny Hart Sep 16 2011 Create Mac App From Shell Script Sep 16 2011 Watch Out for Chuck Testa Sep 15 2011 This? on NY Times Fashion Blog? Sep 14 2011 Windows 8 Is Looking Good Sep 14 2011 I Was Looking for a Delicious App for Mac Sep 13 2011 The Best Music Discovery Service Sep 13 2011 Do You Want to Blow Up the Earth SciFi Style? Sep 13 2011 Octopress Is a Great Jekyll Blogging System Sep 12 2011 The details of the greatest online game scam Sep 12 2011 Great command prompt shortcuts Sep 12 2011 A great video showing how small we are Sep 11 2011 Ruby Mine as a Jekyll front end Sep 10 2011 Easily add search to a static blog Sep 10 2011 Off duty Storm Troopers Sep 09 2011 I would kill for some Nike Mags Sep 09 2011 Capital Factory Demo Day 2011 Sep 07 2011 TablSkin 2 overlay helps with tablet typing Sep 06 2011 How to win a DEMOgod Award at DEMO Sep 06 2011 Using iA Writer with Jekyll Sep 05 2011 Migrated back to Jekyll Sep 05 2011 Cats on a treadmill Sep 05 2011 I laughed really hard when I saw this. Aug 27 2011 get out of there cat. you are not homeless. Aug 25 2011 The Nintendo Cartridge Samurai Will Get All the Babes Aug 19 2011 This baseball player is INSANE Aug 15 2011 Gartner Claiming iOS 62% of smartphone Market Aug 11 2011 HBO, you need to make this into a series Aug 06 2011 Change the Launchpad Folder Background Image Aug 05 2011 Water bridge in Germany. How is this possible? Aug 03 2011 iOS developers building iCloud integration in droves Aug 03 2011 iCloud built using the SproutCore framework Aug 03 2011 Driving the 2012 Bentley Continental GT Aug 03 2011 Cool tour of a Ferrari factory Aug 02 2011 Monster Cable goes after the wrong guy Aug 01 2011 Future Firefox mockup looks hot Aug 01 2011 Banana mascot gets owned by security guard Jul 31 2011 Interesting story about the Olympics Jul 04 2011 Hound-dogs running Jul 04 2011 Crazy kick Jul 04 2011 Undercover Karaoke with Jewel Jul 03 2011 Took the kids to the park today. Nailed it. Jul 02 2011 Cat, you are very bright Jul 01 2011 I wish my bank balance looked like this guys. Jun 30 2011 My daughter playing on her iPad. Jun 29 2011 I’m seriously considering this product Jun 29 2011 Tag Huer outs new phone for $7000. Jun 28 2011 Sick car, great photo Jun 22 2011 I am really excited about these headphones Jun 22 2011 Sick Porsche collection Jun 22 2011 What are those? Mentos? Jun 21 2011 Now this is a fish tank! Jun 21 2011 Another squirrel photo Jun 21 2011 If I only needed a phone Jun 21 2011 What is the Technological Singularity? Jun 19 2011 My cat goes psycho for this video. Jun 19 2011 My girl digs squirrels Jun 19 2011 More tilt-shift photography Jun 18 2011 I love Tilt Shift photography. This photo of a car show is a great example. Jun 18 2011 Amazing 100 seconds tiltshift Jun 18 2011 STUCK Jun 17 2011 Who knew? Jun 17 2011 Using File Vault 2 with multiple drives Jun 10 2011 50 State Stereotypes in 2 minutes. May 30 2011 Tech Tool Pro now allows bootable partition May 29 2011 I saw this on Reddit with the title May 29 2011 Chum Buddy Sleeping Bag May 12 2011 Awesome anti drug advertisement Mar 22 2011 I love customer feedback via Twitter Mar 19 2011 Xcode 4 thoughts Mar 18 2011 Alaska Airlines cancels the nerd bird Mar 08 2011 MegaErase - my first Mac App Store app Mar 05 2011 Slow computer? Add two hard drives. Mar 03 2011 Google docs in real time? Google Wave? Mar 03 2011 Startup Weekend Austin Feb 27 2011 Here is a duck Feb 26 2011 Redis, Ohm and Heroku make caching data super fast Feb 25 2011 Ahhh, iPhone OS programming. Been a while sir. Feb 23 2011 Why I switched to Amazon EC2 hosting and then Heroku Feb 19 2011 Mobile phones and YouTube shake up the middle east Feb 19 2011 rsa security conference loves the cloud Feb 16 2011 great story on about.me acquisition by AOL Feb 14 2011 automatic tv show downloading via sickbeard on a mac Feb 12 2011 california stores can’t ask for zip codes Feb 11 2011 hp launches tablets and phones Feb 10 2011 a bash prompt full of color makes a happy terminal Feb 07 2011 why i am not watching the super-bowl Feb 06 2011 SuperDuper! is the best Mac backup app Feb 06 2011 steven wright reviews gucci watch Feb 06 2011 securely erasing files on your mac Feb 06 2011 women laughing alone with salad Feb 05 2011 iffmpeg is a great gui for ffmpeg mac Feb 05 2011 no guarantee of privacy on social nets Feb 04 2011 dont break up with an seo expert Feb 04 2011 wifi in flight is techno cool Feb 03 2011 do you believe the statistics Feb 03 2011 automating the creation of posts in jekyll Feb 03 2011 Apple purposely adds bugs to iOS releases Feb 01 2011 Bullet Train offers desktop keyboard with form factor of notebook Jan 31 2011 Zosh gets a shout-out in the Wall Street Journal Jan 31 2011 Yes, this is my first post. Jan 31 2011 Sushi Ran in San Francisco is amazing Jan 30 2011 Best peel-out ever Jan 28 2011 Tooth decay by PFFR Jan 28 2011 Taco Bell, real beef or not, damage is done Jan 28 2011 Best peel-out EVER. Jan 24 2011 Twitter, did you just change your icon again? Jan 23 2011 Twitter, did you just change your icon again? Jan 23 2011 See you latr Tumblr Jan 23 2011 Your Exchange server doesn’t have imap? No problem. Jan 23 2011 Women everywhere are offended by this Jan 13 2011 Lucy the cat is 39 years old. (Oldest ever.) Jan 13 2011 The funniest website EVER Jan 07 2011 2010 My first tweet ever. Dec 31 2010 Fantastic Business Card Dec 31 2010 Second largest fish tank in the world Dec 29 2010 Awesome video makes me want to race Dec 29 2010 Vintage effects in iPhone videos. Really? Dec 28 2010 Vintage effects in iPhone videos Dec 28 2010 There are so many times when I need this Dec 28 2010 Repairing your disk with PGP whole disk encryption (Mac) Dec 28 2010 repairing your disk with pgp whole disk encryption mac Dec 28 2010 Absolutely gorgeous Dec 28 2010 Security app Hidden (free until January) Dec 25 2010 Kod - the open source text editor for the Mac Dec 25 2010 Why you shouldn’t fry Gnocchi. Dec 19 2010 National Velocity Alt is a great notepad for the mac Dec 18 2010 My Son Jack As The Fet In A Video I Created With My Kids Today Dec 18 2010 Last minute $500,000 check saves Evernote Dec 17 2010 If I Did Buy A Workstation I8217d Want It To Look Like This Sometimes Dell Has Great Design Dec 17 2010 I Hope Captain Sully Is Driving Dec 17 2010 how to enable ftp uploads to amazon s3 Dec 17 2010 How to enable FTP uploads to Amazon S3 Dec 17 2010 Backup Flickr with Bulkr Dec 17 2010 Cool camera effects on the iPhone Dec 17 2010 Nyc Subway At 42nd St Taken With Instagram Dec 16 2010 Video tagging automation with iFlicks and Hazel Dec 14 2010 now that is how you create a facebook profile page Dec 13 2010 Do you encrypt your hard drive? PGP vs FileVault Dec 13 2010 Go Get Reeder For The Mac If A You Own A Mac And B You Use Google Reader It Is The Best Reader Experience On The Mac Bar None Dec 12 2010 Wow, what a moving speech by a 15 year old student in reaction to the protests in London. Dec 11 2010 First iPhone 4 battery that feels good in your hand. Dec 11 2010 Sparrow is my new Gmail client Dec 10 2010 Some pretty obvious criticisms of Angry Birds. Dec 10 2010 Very cool mashup of Sting and Rudolph the Red Nose Reindeer Dec 08 2010 How to Clean Up Your Mac’s "Open With" Contextual Menu Dec 08 2010 Daft Punk with Tron Derezzed Dec 08 2010 Watch MKV videos on your iPad & iPhone with this script. Dec 07 2010 Google Chrome Web Store Dec 07 2010 deplorableword: Inception in Real-Time (via weikang) Very cool. Dec 07 2010 The Google Nexus S Looks Mighty Pretty Android 23 Also Looks Pretty Sweet This Is Going To Be A Winner For Both Google And Samsung Dec 06 2010 Movieofthedayno Country For Old Men 2007basses Assassin Nothing Like Him Dec 05 2010 My Current Iphone Wallpaper Dec 04 2010 Download an entire website via a simple linux command. Dec 04 2010 Harris Hill Race Track In San Marcos Tx I Took The Trusty Old 911 Turbo S On It And Blew My Mind In The Process Dec 03 2010 This isn’t spam? What? Dec 02 2010 Stranded on the highway because of snow. Dec 02 2010 Redirected to this image after buying this guy’s app. Dec 02 2010 Mophie Juicepack Plus is out. Dec 02 2010 How I got featured on TechCrunch (and many more) Dec 02 2010 Flickr export 4.0 for iPhoto is out. Dec 02 2010 Do I Need This Yes I Do Dec 02 2010 Confirmed: Ebay Acquires Milo For $75 Million. Investors Make A Killing. Dec 02 2010 Chrome 8 is out, but nobody seems to care. Dec 02 2010 Best Burgers in the U.S. | Food and Wine Dec 02 2010 Useful SSH commands and tricks Nov 29 2010 Prioritizing network connections in Mac OS X Snow Leopard Nov 28 2010 Arkhippo iPhone 4 case gives your baby some back Nov 23 2010 How to secure your SSH server. Nov 17 2010 Write your resume in Markdown, keep it in git Nov 16 2010 Simple tip for merging video files on a Mac (free) Nov 16 2010 Is anyone using Kik messenger? Nov 09 2010 How We Raised $1.3 Million as First-Time Founders Nov 08 2010 Using Markdown with Wordpress Nov 07 2010 quickly encode mkv to mv4 compatible with ipad Nov 07 2010 Quickly encode MKV to MV4 compatible with iPad Nov 07 2010 Just Add Water: Household Cleaner In An Empty Bottle Nov 02 2010 Base One Labs introduces ImpactBand: massive iPhone case Nov 02 2010 Improve blog performance with optimized images Nov 01 2010 using duplicity to backup your server to amazon s3 Oct 30 2010 @mailgun: Email interface for your app Oct 29 2010 PageLines PlatformPro: Wordpress CMS perfection Oct 28 2010 Separation between church and Mac? Oct 27 2010 The most important startup discussion: Roles and Goals Oct 26 2010 ReadWriteWeb gives me a shout-out Oct 26 2010 Goldman Sachs is paying Warren Buffet $15 a second. Oct 22 2010 paralyzed woman does a video review of my app Oct 19 2010 Sneakily Snap Pictures with the Camera Camouflage iPhone App Oct 15 2010 iPhone 4 coming to Verizon? Oct 09 2010 Kevin Rose talks about his failures at Digg Oct 03 2010 testflightapp beta test iphone apps without using adhoc Oct 02 2010 How Facebook Can Become Bigger In Five Years Than Google Is Today Oct 02 2010 Fast Society app. Keep up with your friends at a concert Oct 02 2010 How to pitch your startup to the press Sep 26 2010 iPhone 4 vs. iPhone 3GS Jun 07 2010 iPhone 4 vs Droid Incredible vs Android Evo 4G vs Nexus One tech specs Jun 07 2010 iOS 4 Gold Master Release Candidate almost ready for download Jun 07 2010 Blank Canvas Is a Greasemonkey Script Manager for Chrome [Downloads] Jun 07 2010 Mars Edit 3.0 May 04 2010 BlackBerry 6 Preview From WES Apr 29 2010 North Carolina beach town bans thongs Apr 29 2010 Everyday People Making Thousands as Amateur Paparazzi Apr 29 2010 Cool sms replacement Apr 29 2010 I’m speaking at the University of Texas tomorrow Apr 28 2010 Best customer review EVER Apr 28 2010 Transmit is a great ftp client Apr 27 2010 I almost invented Napster. Apr 27 2010 Sweet wallpaper Apr 21 2010 2009 Yummy snack Sep 06 2009 Smart cars can fit anywhere Mar 18 2009 My Canon 5D Mark II camera is awesome. Mar 16 2009 Mars Edit support for Tumblr Mar 16 2009 My iPhone clock Feb 10 2009 Bad photo of me Feb 03 2009 Giants win the superbowl! Feb 02 2009 Qik on a non-hacked iphone.  Breakfast of champions Oct 10 2008 Newcastle At The Denver Airport Oct 05 2008 Teaching My Kid To Ride A Bike Sep 28 2008 I love Shiner Black beer Sep 28 2008 Perrier With Lime Sep 17 2008 Fireman’s 4 is a great beverage Sep 03 2008 A video of my office from Qik.com Aug 26 2008 How to win a fight against 20 children Aug 19 2008 Work sux Aug 18 2008 Scotch Greatest Of Mans Creations Aug 14 2008 Fantastic t-shirt design Aug 13 2008 Free Booze At The First Class Lounge In Singapore For Sing Air Aug 12 2008 First Class On Singapore Airlines 777 Aug 12 2008 First Class Lounge At Moscows Domo Airport Aug 12 2008 I’m really loving FreshBooks Jul 30 2008 Getting excited about the WWDC 2008 keynote Jun 09 2008 Working Jun 07 2008 iPhone. Jun 07 2008 Twitter is the most unstable service ever! Jun 06 2008 This is a quick little video I show with Qik (www.qik.com.)Â I really dig being able to stream video from my cell phone to the web. Apr 16 2008 My first tumblr post. Apr 16 2008 kevinrose: Lip Dub - Need You Tonight by INXS (Revision3) Â I thought this was kind of funny. Apr 16 2008 Ahh, the New York bagel. Apr 16 2008
If I Did Buy A Workstation I8217d Want It To Look Like This Sometimes Dell Has Great Design Dec 17 2010
Go Get Reeder For The Mac If A You Own A Mac And B You Use Google Reader It Is The Best Reader Experience On The Mac Bar None Dec 12 2010
Wow, what a moving speech by a 15 year old student in reaction to the protests in London. Dec 11 2010
The Google Nexus S Looks Mighty Pretty Android 23 Also Looks Pretty Sweet This Is Going To Be A Winner For Both Google And Samsung Dec 06 2010
Harris Hill Race Track In San Marcos Tx I Took The Trusty Old 911 Turbo S On It And Blew My Mind In The Process Dec 03 2010
This is a quick little video I show with Qik (www.qik.com.)Â I really dig being able to stream video from my cell phone to the web. Apr 16 2008
kevinrose: Lip Dub - Need You Tonight by INXS (Revision3) Â I thought this was kind of funny. Apr 16 2008


World Para-Athletics Championships: Cockroft retains T34 800m title, Adenegan takes silver
by Katie FalkinghamHannah Cockroft retained her T34 800m title at the World Para-Athletics Championships as Kare Adenegan took silver in a British one-two.
A dominant Cockroft, 27, set a new championship record of one minute 57.27 seconds in Dubai.
And 18-year-old Adenegan - who led in the early stages of the race - crossed the line more than four seconds later.
Five-time Paralympic champion Cockroft has now won 12 world titles across all distances.
"I didn't really have a plan," she told BBC Sport. "I won it; that was the only tactic behind it.
"Kare really surprised me. She went out strong to the front and she was very welcome to do that because it was quite hot outside.
"I hate being pushed to the front of the race, so she really made the race easy for me. She allowed me to save myself for the last 400m."
It was Cockroft's second gold medal of the championships, as she won the 100m title on Sunday.
After that race, Yorkshire's Cockroft admitted she had "fallen out of love" with the sport in 2018 but on Thursday, she told BBC Sport her fire had been reignited in Dubai.
"This is what I needed - I needed to come here and remind myself of what I love doing and why I love doing it," she said.
"It's really done that; it's motivated me. The girls are still not as far away from me as I'd like them to be, so I need to work hard and go quicker."
Adenegan - who now has two silver medals in Dubai, having finished second to Cockroft over the sprint distance - beat American Alexa Halko to second place by just three hundredths of a second in a tight finish.
"I am so happy with that," the three-time Paralympic medallist told BBC Sport. "That was probably the best 800m I've had.
"I don't think I've ever beaten Alexa over the 800m because she is really strong. I saw that I was ahead of her but knew I needed to push a bit harder, and it was enough. It was a tough race."
Elsewhere in Thursday's morning session, Paul Blake - who won T36 800m earlier in the championships - finished fifth in the 400m final.
Martina Barber placed eighth in the T20 long jump final, while Anna Nicholson was fourth in the F35 shot put.
Jordan Howe reached the T35 100m final after finishing second in his heat, but the Great Britain quartet of Libby Clegg (and guide Thomas Somers), Ola Abidogun, Sophie Hahn and Mickey Bushell missed out on the universal 4x100m relay final.


|
Query
Tags
Metadata
Physical
Upload
Export
Debug
{{me.id}} / {{me.name}} :: {{feed.offset + current.index + 1}} of {{feed.total_count}} :: {{message}}
|
||
|
After
Before
Format like YYYY-MM-DD.
Source
Have these tags
Does not have these tags
Image entries
Video entries
Audio entries
Other entries
Show hidden entries
Show only hidden entries
Show deleted entries
Show only deleted entries
Enter also updates.
|
|
|
|


To generate various graph.
bluejson Charts is a library to generate various graphs or chats using d3.js
Current version: 0.1
You must include d3.js in any pages in which you wish to use bluejson Charts.
The library is tested against Firefox, Chrome, Safari and IE9.
If you only intend to make use of bluejson Charts in your web page just include the following script references:
<script src="http://d3js.org/d3.v3.min.js"></script>
<script src="js/blue.json.charts.js"></script>
You can then access the API from the blue namespace.


Swap items, check stats, build the loadout to Become Legend with DIM
Launch apptry the betaForgot to grab your favorite hand cannon? Just click and drag it to your active charcter.
Need those STOMP-EE5 for the jumping puzzle? Fire up DIM and grab them.
Create the perfect loadout for Raids, Strikes, Gambit, and any other loadout that woud be helpful.
Keep your inventory in check with powerful search queries. Check out our video on search.
Review and rate your favorite guns, and let others know what you think.
Organize your stuff by what to keep, what's your favorite, what to infuse and what to get rid of.