本文介绍了一个随机不生成仅一次的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有项目在线考试.我只想第二次不生成该数字就生成一个随机数,因为我想针对该数字选择问题. 没有生成的总数为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.
更多推荐
一个随机不生成仅一次
发布评论