我有一個很奇怪的問題在vb.net中,由於某種原因system.random()是不是被隨機都在我的任何功能:隨機函數返回相同數量的反覆
Public Function RandomNumber(ByVal MaxNumber As Integer, Optional ByVal MinNumber As Integer = 0) As Integer
Dim R As System.Random = New System.Random()
If MinNumber > MaxNumber Then
Dim T As Integer = MinNumber
MinNumber = MaxNumber
MaxNumber = T
End If
Return R.Next(MinNumber, MaxNumber)
End Function
這裏在正確調用9次後的結果
4
4
4
3
3
3
3
3
3
這與C#有什麼關係? – MyCodeSucks 2013-03-27 21:37:06
.net C#相同的東西 – Jedigasm 2013-03-27 21:37:40
另請參閱 - http://csharpindepth.com/Articles/Chapter12/Random.aspx – 2013-03-27 21:37:56