Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- randomize(timer())
- function getRandom(min as integer, max as integer) as single
- return (max - min) * rnd() + min
- end function
- function getRandomInt(min as integer, max as integer) as integer
- return (max - min) * rnd() + min
- end function
- dim as integer totalTests = 10000
- dim as single highest, lowest = 999999
- dim as integer lz, z, gz
- for i as integer = 0 to totalTests
- dim as single current = getRandom(-1, 1)
- if(current < lowest) then lowest = current
- if(current > highest) then highest = current
- next i
- for i as integer = 0 to totalTests
- dim as single current = getRandomInt(-1, 1)
- if(current < 0) then lz+=1
- if(current = 0) then z+=1
- if(current > 0) then gz+=1
- next i
- print("=== Results ===")
- print("Highest: " & highest)
- print("Lowest: " & lowest)
- print("lz: " & lz & " - " & (lz/totalTests)*100 & "%") ' Less than zero
- print("z: " & z & " - " & (z/totalTests)*100 & "%") ' Zero
- print("gz: " & gz & " - " & (gz/totalTests)*100 & "%") ' Greater than zero
- sleep()
Add Comment
Please, Sign In to add comment