14 lines
241 B
Python
14 lines
241 B
Python
|
import numpy as np
|
||
|
|
||
|
|
||
|
def decision(h1, h2):
|
||
|
if len(h1) == 0:
|
||
|
r = np.random.randint(2)
|
||
|
return r
|
||
|
else:
|
||
|
avg = 1.0 * sum(h1) / len(h1)
|
||
|
if avg <= 0.5:
|
||
|
return 0
|
||
|
else:
|
||
|
return 1
|