2

In my C# code I need to create a Weibull random variable like this:

Weibull myVar= new Weibull(3, 5);

However, I would also like to set a seed so that the random numbers generated by this object are the same each time I run my program. In other words, I am looking for a Weibull-equivalent to

int seed = 12345;
Random myVar2 = new Random(seed);

How can I achieve that?

Uwe Keim
  • 39,551
  • 56
  • 175
  • 291
BJPrim
  • 338
  • 5
  • 20
  • Can you share some code? The Weibull Distribution just depends on Shape Factors, doesn't it? While I'm not sure which library you're using for your Weibull distribution, can't you look in that library to see how it gets a "random" number (if at all), and modify that code? – ainwood Jul 31 '17 at 00:40

1 Answers1

0

Found the solution myself - very easy and straightforward, don't know why I didn't come across it in the first place at all:

int seed = 12345;
Random myRandom = new Random(seed);
Weibull myWeibull= new Weibull(3, 5, myRandom);

That's it - works for all other distributions in the same way.

BJPrim
  • 338
  • 5
  • 20