From 758995d5dadfaa8c55a88b56bbde1c50753550ba Mon Sep 17 00:00:00 2001 From: "Watal M. Iwasaki" Date: Wed, 29 Nov 2017 12:08:08 +0900 Subject: [PATCH] :fire: Remove canonical() method --- sfmt.hpp | 35 ----------------------------------- 1 file changed, 35 deletions(-) diff --git a/sfmt.hpp b/sfmt.hpp index 0b5af05..8f906d0 100644 --- a/sfmt.hpp +++ b/sfmt.hpp @@ -13,23 +13,6 @@ namespace wtl { /////////1/////////2/////////3/////////4/////////5/////////6/////////7///////// -namespace { - union bits64_t { - uint64_t as_uint64_t; - uint32_t as_uint32_t[2]; - double as_double; - - bits64_t(uint64_t x): as_uint64_t{x} {} - bits64_t(uint32_t x, uint32_t y): as_uint32_t{x, y} {} - - // Use 52 bits to make double [0.0, 1.0) - double as_canonical() const { - bits64_t exponent_zero = (as_uint64_t >> 2) | 0x3ff0'0000'0000'0000; - return exponent_zero.as_double - 1.0; - } - }; -} - class sfmt19937 { public: typedef uint32_t result_type; @@ -50,15 +33,6 @@ class sfmt19937 { return sfmt_genrand_uint32(&state_); } - // [0.0, 1.0) - double canonical() { - return std::generate_canonical::digits>(*this); - } - // possible implementation - double _canonical() { - return bits64_t(this->operator()(), this->operator()()).as_canonical(); - } - void seed(const result_type s) { sfmt_init_gen_rand(&state_, s); } @@ -95,15 +69,6 @@ class sfmt19937_64 { return sfmt_genrand_uint64(&state_); } - // [0.0, 1.0) - double canonical() { - return std::generate_canonical::digits>(*this); - } - // possible implementation - double _canonical() { - return bits64_t(this->operator()()).as_canonical(); - } - void seed(const result_type s) { sfmt_init_gen_rand(&state_, s); }