lq = Int(Label2.Caption)
Randomize
gailv = Int(Rnd * 1000 + 1)
Select Case gz
Case gz = 0 '上1
If gailv < 400Then
Label2.Caption = Int(Label2.Caption) + 1
Form3.Show
Else
Form1.Show
Label2.Caption = 0
End If
Case gz = 1 '1上2
If gailv <300 Then
Label2.Caption = Label2.Caption + 1
Form3.Show
Else
Form1.Show
Label2.Caption = 0
End If
Case gz = 2 '2上3
If gailv <250 Then
Label2.Caption = Label2.Caption + 1
Form3.Show
Else
Form1.Show
Label2.Caption = 0
End If
Case gz = 3 '3上4
If gailv <200 Then
Label2.Caption = Label2.Caption + 1
Form3.Show
Else
Form1.Show
Label2.Caption = 0
End If
Case gz = 4 '4上5'
If gailv <130 Then
Label2.Caption = Label2.Caption + 1
Form3.Show
Else
Form1.Show
Label2.Caption = 0
End If
Case gz = 5 '5上6'
If gailv <90 Then
Label2.Caption = Label2.Caption + 1
Form3.Show
Else
Form1.Show
Label2.Caption = 0
End If
Case Else '+6以上'
If gailv <10Then
Label2.Caption = Label2.Caption + 1
Form3.Show
Else
Form1.Show
Label2.Caption = 0
End If
End Select
End Sub
个程序的意思是:
+1 40%成功+2 30%成功+3~+5 反正就是后面那个数字除以1000的概率成功
+6以上就1%概率了~大致是这样:Randomize代表在0到1中取一个随机数,乘以1000再加一就是1到1000;后面什么诸如<400就是概率了,如果小于就成功(应该不是失败吧,不然怎么会越来越小)否则失败~