From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15661 invoked by alias); 24 Jun 2010 09:54:00 -0000 Received: (qmail 15642 invoked by uid 48); 24 Jun 2010 09:53:50 -0000 Date: Thu, 24 Jun 2010 09:54:00 -0000 Message-ID: <20100624095350.15641.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug libstdc++/44653] A uniform_real random distribution produces invalid floating-point random numbers In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "dchichkov at gmail dot com" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2010-06/txt/msg02324.txt.bz2 ------- Comment #1 from dchichkov at gmail dot com 2010-06-24 09:53 ------- Update. Following code produces the correct value: #include #include #include int main() { typedef std::mt19937 eng_t; typedef std::uniform_real dist_t; typedef std::variate_generator gen_t; eng_t eng; dist_t dist(0.0, 1.0); gen_t gen(eng, dist); std::cout << gen() << std::endl; return 0; } -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44653