Boost.Random Support

#include <boost/int128/random.hpp>

Including this header specializes the traits that Boost.Random uses to reason about integer types, so that int128 and uint128 can be used directly with the Boost.Random engines and distributions such as boost::random::uniform_int_distribution. This header requires Boost.Random to be available.

The following specializations are provided in namespace boost::random::traits for both int128 and uint128:

Trait Purpose

is_integral

Reports both types as integral.

is_signed

Reports int128 as signed and uint128 as unsigned.

make_unsigned, make_unsigned_imp

Provide the unsigned type mapping Boost.Random uses when generating values.

make_unsigned_or_unbounded, make_unsigned_or_unbounded_imp

Provide the unsigned-or-unbounded type mapping Boost.Random uses.

These specializations live in boost::random::traits, not boost::int128.

An example combining Boost.Random with the library types is available on the examples page.