Boost logo

Boost Users :

Subject: [Boost-users] Random Numbers using Boost.
From: Atul Kulkarni (atulskulkarni_at_[hidden])
Date: 2009-01-12 20:21:50


Hi All,

I am using boost::random for generating random numbers I am using the
default quick start code given up on the web page. I want to generate random
numbers between range 1 - n so that they do not repeat themselves for at
least n numbers.

1. Is it possible using boost::random?
2. If it is possible what do I need to do except the below code.

==
        boost::mt19937 rng1;
        boost::uniform_int<> six1(1,30);
        boost::variate_generator<boost::mt19937&, boost::uniform_int<> >
die1(rng1, six1);
        for(int i=0; i < 29; i++)
        {
            cout<<die1()<<endl;
        }
==
Thanks in advance.

-- 
Regards,
Atul Kulkarni
Teaching Assistant,
Department of Computer Science,
University of Minnesota Duluth
Duluth. 55805.
www.d.umn.edu/~kulka053


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net