一个随机不生成仅一次

编程入门 行业动态 更新时间:2024-10-25 16:20:07
本文介绍了一个随机不生成仅一次的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我有项目在线考试.我只想第二次不生成该数字就生成一个随机数,因为我想针对该数字选择问题. 没有生成的总数为40. 我的平台是c#(网站)

i have project online examination. i want to generate a random number only once second time that number not generate,because i want to select question with respect to that number. total no of no generate is 40. my platform is c#(website)

推荐答案

希望简单的随机数生成 [ ^ CP的文章可能会对您有所帮助. Hope Simple Random Number Generation[^]article from CP might help you.

除非您从号码集中删除号码,否则无法保证号码不会再次出现的机会.第六标准中的简单概率论.从扑克牌组中随机选择您的女王可能会一次又一次地发生,除非将选定的女王从牌组中移除. 您可以很好地使用良好的随机数生成器作为Ramalinga的链接,也可以使用.Net的Random类.如果范围很大,您会感觉到没有重复.但并非100%正确.您需要的是在使用该号码之前检查一下.如果已经得到,则将其丢弃. There is no guarantee that the chance of the number not coming again unless you remove the number from the set. Simple probability theory in 6th standard. From the deck of playing cards random choosing your queen can happen again and again unless the chosen queen is removed from the deck. You can very well use a good random number generator as the link given by Ramalinga''s or use .Net''s Random class. If you range is large you perceive there is no repetition. But not 100% true. What you need is check before using that number that did you already got it or not. Then discard it if already got it.

更多推荐

一个随机不生成仅一次

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

发布评论

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

>www.elefans.com

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