vb.net随机固定数据 vb随机数字的代码( 二 )


Dim p68 As Integer
Randomize()
p68 = Int(Rnd() * 2) + 1
Dim a(10), b(8) As Integer
For i = 1 To 6
b(i) = i - 1
Next
b(7) = 7
b(8) = 9
For i = 1 To 6
Randomize()
a(i) = b(Int(Rnd() * 8) + 1)
Next
If p68 = 1 Then
For i = 7 To 10
a(i) = 6
Next
ElseIf p68 = 2 Then
For i = 7 To 10
a(i) = 8
Next
End If
Dim c(10) As Integer
Dim temp As jiqi
Dim pi(10) As jiqi
For i = 1 To 10
pi(i).num = a(i)
pi(i).num2 = Int(Rnd() * 1000) + 10
Next
For i = 1 To 10
For j = 1 To 10 - i
If pi(j).num2pi(j + 1).num2 Then
temp = pi(j + 1)
pi(j + 1) = pi(j)
pi(j) = temp
End If
Next j
Next i
For i = 1 To 10
str = strpi(i).num
Next
Return str
End Function
请问在vb.net中如何实现随机取数??Dim k() As Integer = New Integer() {1, 2, 3, 4, 5, 6}
Dim p1 As Integer
Random r = new Random();
int p1 = k(r.Next(5)) '随机出现0~5之间vb.net随机固定数据的数 。
关于vb.net随机固定数据和vb随机数字的代码的介绍到此就结束了 , 不知道你从中找到你需要的信息了吗 ?如果你还想了解更多这方面的信息,记得收藏关注本站 。

推荐阅读