8#ifndef INCLUDED_BDLB_PCGRANDOMGENERATOR
9#define INCLUDED_BDLB_PCGRANDOMGENERATOR
225#include <bdlscm_version.h>
229#include <bsl_cstdint.h>
245 bsl::uint64_t d_state;
246 bsl::uint64_t d_streamSelector;
286 void seed(bsl::uint64_t initState, bsl::uint64_t streamSelector);
320 bsl::uint64_t streamSelector)
322 seed(initState, streamSelector);
329 static const bsl::uint64_t k_MULTIPLIER = 6364136223846793005ULL;
331 bsl::uint64_t oldstate = d_state;
334 d_state = oldstate * k_MULTIPLIER + d_streamSelector;
337 bsl::uint32_t xorshifted =
338 static_cast<bsl::uint32_t
>(((oldstate >> 18u) ^ oldstate) >> 27u);
339 bsl::uint32_t rot =
static_cast<bsl::uint32_t
>(oldstate >> 59u);
340 return (xorshifted >> rot) | (xorshifted << ((0u - rot) & 31u));
345 bsl::uint64_t streamSelector)
347 d_streamSelector = (streamSelector << 1u) | 1u;
351 d_state += initState;
360 const PcgRandomGenerator& rhs)
362 return lhs.d_state == rhs.d_state &&
363 lhs.d_streamSelector == rhs.d_streamSelector;
368 const PcgRandomGenerator& rhs)
370 return !(lhs == rhs);
Definition bdlb_pcgrandomgenerator.h:242
void seed(bsl::uint64_t initState, bsl::uint64_t streamSelector)
Definition bdlb_pcgrandomgenerator.h:344
PcgRandomGenerator(const PcgRandomGenerator &original)=default
friend bool operator==(const PcgRandomGenerator &lhs, const PcgRandomGenerator &rhs)
PcgRandomGenerator()
Definition bdlb_pcgrandomgenerator.h:313
PcgRandomGenerator & operator=(const PcgRandomGenerator &rhs)=default
bsl::uint32_t generate()
Definition bdlb_pcgrandomgenerator.h:327
#define BSLS_IDENT(str)
Definition bsls_ident.h:195
Definition bdlb_algorithmworkaroundutil.h:74
bool operator!=(const BigEndianInt16 &lhs, const BigEndianInt16 &rhs)
bool operator==(const BigEndianInt16 &lhs, const BigEndianInt16 &rhs)