Thank you! What in fact I am trying to do is to generate random numbers between two values, but I want that the values in the middle are to be selected more often. That's why I thought of Normal Distribution.
I'm not sure, if I was clear enough?!
This is my code, using your explanation:
private static float RandomNormalDistribution(float min, float max)
{
bool validity = false;
float returnValue = 0.0f;
while (!validity)
{
returnValue = (float)Normal.Sample(random, 0, 1);
if (returnValue >= 4.0f && returnValue <= 4.0f)
{
validity = true;
}
}
float valueShift = returnValue + 4.0f;
float percentage = valueShift * 100.0f / 8.0f;
return min + (max  min) * percentage * 0.01f;
}
I was wondering if you can give your opinition. Am I using the sample function correctly?
Thank your very much!
Gabriel Blanco
private static float RandomNormalDistribution(float min, float max)
{
bool validity = false;
float returnValue = 0.0f;
while (!validity)
{
returnValue = (float)Normal.Sample(random, 0, 1);
if (returnValue >= 4.0f && returnValue <= 4.0f)
{
validity = true;
}
}
float valueShift = returnValue + 4.0f;
float percentage = valueShift * 100.0f / 8.0f;
return min + (max  min) * percentage * 0.01f;
}
