I have a strange issue (at least for me) with generating random double values. I am doing this:
Random rndparam = new Random();
double param1 = rndparam.NextDouble() * (paramUpperBound - paramLowerBound) + paramLowerBound;
MySheetWrite.Cells[i + 1, 1] = param1;
I am trying to generate more parameters like this (with positive values), however I am getting negative values for few of them (all values for these parameters are negative) and for other parameters, there are also few negative values. There are however few parameters that are generated correctly between upper and lower bound. I am pretty sure that paramUpperBound is allways greater than paramLowerBound.
Also, to generate another parameters I am using rndparam object and these parameters are generated in one for loop.
Thank you for any advices.
Aucun commentaire:
Enregistrer un commentaire