Answer the question
In order to leave comments, you need to log in
How to get a binary sequence in numpy using mt19937?
You need to get a binary sequence using the Mersenne Vortex. There was an idea to use the built-in python random like this:
import random as rd
p=[]
k=int(1.1*10**8)
for i in range(k):
p.append(rd.getrandbits(1))
#print(p)
s=''
for i in p:
s+=str(i)
a=p.count(0)
b=p.count(1)
f = open('sec.txt', 'w')
f.write(s)
f.close()
print(a,b)
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question