Skip to content
This repository has been archived by the owner on Aug 15, 2019. It is now read-only.

Latest commit

 

History

History
52 lines (27 loc) · 935 Bytes

README.md

File metadata and controls

52 lines (27 loc) · 935 Bytes

#Law of Large Numbers

Probability Theory says as number of the trials increases, the average outcome will get closer to the expected average output. source

This code implements 10k of dice rolls and 10k of coin flips and counts the number of occurings and calculates averages for the 10, 100, 1000 and 10k trials.

Expected average output for dice rolls : 3.5

Expected output for coin flips : 1.5 (1 for heads and 2 for tails)

##Sample output

Count for dice roll occurings 10/100/1K/10K

[1, 2, 2, 1, 1, 3]

[10, 18, 13, 18, 19, 22]

[151, 178, 166, 158, 173, 174]

[1589, 1731, 1650, 1658, 1730, 1642]

Average value for dice rolls 10/100/1K/10K

3.8

3.84

3.546

3.5135

Count for coin flip occurings 10/100/1K/10K

[4, 6]

[52, 48]

[505, 495]

[4997, 5003]

Average value for coin flips 10/100/1K/10K

1.6

1.48

1.495

1.5003

D3.js Visualization will be added