scientific-programming-exer.../exam/ex13/model.py

14 lines
141 B
Python
Raw Normal View History

2019-02-23 19:38:37 +00:00
import numpy as np
def prepare_model(n, p):
"""
p must be between 0 and 1.
"""
return (np.random.rand(n, n) < p).astype(np.int8)