vb 随机数
1 Private Sub Form_Click()
2 Debug.Print Rndnum(-1000, 1000)
3 End Sub
4
5 Public Function Rndnum(min As Long, max As Long) As Long
6 Randomize
7 Rndnum = Int((max - min + 1) * Rnd + min)
8 End Function
9
2 Debug.Print Rndnum(-1000, 1000)
3 End Sub
4
5 Public Function Rndnum(min As Long, max As Long) As Long
6 Randomize
7 Rndnum = Int((max - min + 1) * Rnd + min)
8 End Function
9