在C#中生成随机数

编程入门 行业动态 更新时间:2024-10-26 02:28:33
本文介绍了在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.

更多推荐

在C#中生成随机数

本文发布于:2023-11-08 16:21:48,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1569870.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:随机数

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!