Advertisement
BobMe

probability thing

Sep 9th, 2019
172
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. prob = 75
  2. amount = 500
  3.  
  4. --script
  5. tab = {}
  6. probb = 0
  7. for i=1,prob do
  8. table.insert(tab,i)
  9. end
  10.  
  11. for i=1,amount do
  12. local randomnumber = math.random(1,100)
  13. local hecc = false
  14. for i=1,#tab do
  15. if tab[i] == randomnumber then
  16. hecc = true
  17. break
  18. end
  19. end
  20. if hecc == true then
  21. probb = probb + 1
  22. end
  23. end
  24.  
  25. print(probb.." out of "..amount..", with an actual probability of: "..probb/amount.."%")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement