Quote:
Originally posted by Spajeoly
yeah, my bad, i was on 1 hour of sleep when I did that.
See, that's the trick you need to learn, admit when you're wrong. Nothing can have a 125% of happening.
I've even commented my code. :lol:
VB Code:
Dim x As Long, lRnd As Long, lAvg As Long
Dim c As Long, y As Long
Randomize
For y = 1 To 1000000
'Four rolls
For x = 1 To 4
'compute random number 1 to 6
lRnd = Int(Rnd * 6) + 1
'if roll is 5 or 6, add it to the counter, c
If lRnd = 5 Or lRnd = 6 Then c = c + 1
Next x
'add counters together, so we can get an average
lAvg = lAvg + c
'reset counter
c = 0
Next y
MsgBox lAvg / 1000000 ' display average 5 or 6 per four rolls