在vb.net中生成介于0到8之间的唯一5个随机数 [英] generate unique 5 random numbers between 0 to 8 in vb.net
本文介绍了在vb.net中生成介于0到8之间的唯一5个随机数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
plz帮助我生成5到8之间的5个唯一随机数.
plz help me in generating 5 unique random number between 0 to 8
推荐答案
这是关于System.Random
的信息,请参见http://msdn.microsoft.com/en-us/library/system.random.aspx [System.Collection.Generic.Dictionary)中;每次检查新添加的值是否已经在字典中.如果已经存在,请重试(如果未添加).
—SA
This is aboutSystem.Random
, see http://msdn.microsoft.com/en-us/library/system.random.aspx[^]. Don''t repeat a common mistake, the instance of this class only once (per application domain per runtime).
What means "unique"? Does it mean all 5 should be different? In this case, put all generated values in dictionary (System.Collection.Generic.Dictionary
); each time check up if the newly added value is already in dictionary. If it is already there, try again, if not add it.
—SA
这篇关于在vb.net中生成介于0到8之间的唯一5个随机数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文