在C#中生成随机数

问题描述:

嗨。

如何在(a)和(b)之间生成n个随机数,这些数字大概是(x)?



我尝试了什么:



hi。

如何在两者之间生成n个随机数(a)和(b)围绕像(x)这样的数字?

hi.
how can i generate n random number between (a) and (b) that are around a number like (x)?

What I have tried:

hi.
how can i generate n random number between (a) and (b) that are around a number like (x)?

Google是你的朋友,有很多答案和细节;



随机随机=新的随机();

int randomvalue = random.Next(a,b + 1);



你对像(x)这样的数字是什么意思?
Google is your friend, lots of answers and details;

Random random = new Random();
int randomvalue = random.Next(a, b + 1);

What do you mean by "on a number like (x)"?


参见这个例子: [ dotnetperls ]
See this example: [dotnetperls]


引用:

我如何在(a)和(b)之间生成n个随机数,这些数字类似于( x)?

how can i generate n random number between (a) and (b) that are around a number like (x)?



C#有随机函数,第一步是读取电子文档。


C# have random function, first step is to read the documentation.