Boost logo

Boost :

From: Gustavo Romero (gustavo_at_[hidden])
Date: 2006-01-25 08:24:58


Hi,

I want to toss a coin in c++. I don't want to use variate_generator
because my program use it many million times. The code is:
   boost::mt19937 mt;
   boost::detail::uniform_smallint_integer<boost::mt19937, bool>
coin(mt, false, true);

and the error (with gdb) is:
   
boost::detail::uniform_smallint_integer<boost::random::mersenne_twister<unsigned
int, 32, 624, 397, 31, 2567483615u, 11, 7, 2636928640u, 15, 4022730752u,
18, 3346425566u>, bool>::operator() (this=0x804d9e4) at
/usr/include/boost/random/uniform_smallint.hpp:67
67 return (((*_rng)() - (_rng->min)()) / _factor) % _range + _min;

because _factor = 0 and we don't know to divide by 0, aren't we?

Is this a bug or am I doing something wrong?

thanks for your time :)

Gustavo

-- 
Gustavo Romero López
Arquitectura y Tecnología de Computadores
E.T.S.I. Informática. Universidad de Granada
Tel: 958 240589              Fax: 958 248993

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk