xmin,xmax C#代码之间的随机数 [英] Random number between xmin, xmax C# code

查看:109
本文介绍了xmin,xmax C#代码之间的随机数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

At first between xmin, xmax a random number x . And then between xmin, x is a random number to find another with C #





我的尝试:



本学期培训讲师的一部分





What I have tried:

Part of the training instructor for the semester

Random r = new Random();
 for (int i = 0; i < int.Parse(popsizetxt.Text); i++)
 {
 x = r.Next(Int32.Parse(xmin.Text), Int32.Parse(xmax.Text)) + r.NextDouble();

 x = r.Next(Int32.Parse(xmin.Text), Int32.Parse(xmax.Text)) + r.Next();

推荐答案

Random.Next( ) Random.NextDouble()不是唯一的 Random 成员。

还有 Random.Next(int,int)

Random.Next方法(Int32,Int32)(系统) [ ^ ]。



是否很难看到类定义?



-SA
Random.Next() and Random.NextDouble() are not the only Random members.
There is also Random.Next(int, int):
Random.Next Method (Int32, Int32) (System)[^].

Is it so hard to look at the class definition?

—SA

这篇关于xmin,xmax C#代码之间的随机数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆