Just copy it directly
#region Generate a 2-digit random number
public double NextDouble(Random ran, double minValue, double maxValue, int decimalPlace)
{
double randNum = ran.NextDouble() * (maxValue – minValue) + minValue;
return Convert.ToDouble(randNum.ToString(“f” + decimalPlace));
}
#endregion
Example: Take a random number directly from 70-90 each time
Random ran = new Random();
NextDouble(ran,70,90,2);
Similar Posts:
- Set this node to 2: / proc / sys / kernel / kptr during Android init_ restrict
- [Solved] Java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.Double
- Transcoding of system.web.httputility.urlencode in C #
- Solution to the problem of Java program “resource leak: ‘SC’ is never closed” in vscode
- sklearn.utils.validation.check_random_state(seed)
- Postgres invalid command data recovery processing
- [Solved] Pycharm Error: Error: failed to send plot to http://127.0.0.1:63342
- How to operate word batch conversion PDF? Can word be converted to PDF at one time?
- AWS S3 CLI – Could not connect to the endpoint URL
- [Solved] Java collections.sort Error: Comparison method violates its general contract!