-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathciBootstrap.py
More file actions
51 lines (42 loc) · 1.09 KB
/
Copy pathciBootstrap.py
File metadata and controls
51 lines (42 loc) · 1.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import random
units = []
gotten = []
differences = []
class Unit:
def __init__(self, value):
self.value = value
units.append(self)
def indexOf(value, array):
for x in range(0, len(array)):
if array[x] >= value:
return x
def highIndexOf(value, array):
for x in range(0, len(array)):
if array[x] > value:
return x
sampX = 16
n = 20
ci = 0.95
for x in range(0, n):
if x < sampX:
temp = Unit(True)
else:
temp = Unit(False)
amount = 100000
for x in range(0, amount):
for x in range(0, 20):
gotten.append(units[random.randint(0, 19)])
success = 0
for x in gotten:
if x.value == True:
success += 1
differences.append(success)
gotten.clear()
differences.sort()
lowNum = differences[int(amount * ((1 - ci) / 2))]
highNum = differences[int(amount * (((1 - ci) / 2) + ci))]
lowIndex = highIndexOf(lowNum, differences)
highIndex = indexOf(highNum, differences)
print((highIndex - lowIndex) / amount)
print(lowNum/n)
print(highNum/n)