Boost logo

Boost Users :

From: Bruno Martínez (br1_at_[hidden])
Date: 2006-04-04 12:25:29


On Thu, 23 Mar 2006 12:37:04 -0300, Kamil Renczewski <hand7_at_[hidden]> wrote:

> Hello
> I have a problem.
> I need to write program, whitch interprets arguments given at
> runtime and create generators from this arguments. Then i have to
> use this generators (by calling operator() method) to generate
> numbers. Problem is that i dont know type of generators at compile
> time and i dont know how to store them in struct or class or even
> pass to a function.
> Here is en example of my thinking:
> i run program like this: generators N 10 2 E 2.3
> and i would like to get some ramdom numbers from a
> normal_distribution<>(10, 2) and exponential_distribution<>(2.3)
> another run of a program might be: generators U -10 30 G 0.3 whitch
> should give me an uniform_int<>(-10, 30) and
> geometric_distribution<>(0.3) .
>
> Any ideas how to do this?

I would use boost::function objects that store internally the appropiate
generator.

Bruno


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