M
marine-tex
Guest
It seems to me that the following stmt
r=rnd*(rnd*(rnd*200))
ought to return a value over 199 occasionally (about 1 in 8 million times or so). However, I've run this stmt in the following program, and in over 25,600,000,000 tries it has never reported a value over 199. (However, 198 occurs regularly.)
What am I missing here?
option explicit off
Module mainModule
Sub Main()
randomize()
for y=1 to 1000000
for x = 1 to 8000000 : R=rnd*(rnd*(rnd*200))
if r>199 then console.writeline(" ! 199 ! ") ' Report if value is over 199
next x
console.write(Cstr+" ") ' Report every 8 million tries
next y
End Sub
End Module
[Visual Basic 2008 vista SP1]
Continue reading...
r=rnd*(rnd*(rnd*200))
ought to return a value over 199 occasionally (about 1 in 8 million times or so). However, I've run this stmt in the following program, and in over 25,600,000,000 tries it has never reported a value over 199. (However, 198 occurs regularly.)
What am I missing here?
option explicit off
Module mainModule
Sub Main()
randomize()
for y=1 to 1000000
for x = 1 to 8000000 : R=rnd*(rnd*(rnd*200))
if r>199 then console.writeline(" ! 199 ! ") ' Report if value is over 199
next x
console.write(Cstr+" ") ' Report every 8 million tries
next y
End Sub
End Module
[Visual Basic 2008 vista SP1]
Continue reading...