I need to create a matrix N * N of true random numbers, where N can be from ten thousand to a million

I found the quantumrandom library, which returns random numbers from a quantum computer. This is only in the code that returns the matrix of the remainder of dividing numbers by 2

matrix = [] #array with ALL random numbers div = np.zeros(N) + 2 for i in range (0,N): row = qr.get_data(array_length=N) # array of N random numbers row = row % div matrix.append (row) #matrix N*N 

even with N = 1000, the error timeout knocks out

My question is, what other tools can I use in Python that can return a large random number matrix?

The random module does not suit me

  • one
    And what's the point of using exactly “true random” data? Why can't I use the standard random module? - Xander
  • array_length cannot be larger than 1024 - m0nte-cr1st0
  • one
    because it is necessary for a mathematical problem and if I use the random module, the solution will be incorrect. - Sofiya Shvets pm
  • And your math task will be correct if the labor random returns 42 zeroes in a row, which TeorVer does not prohibit? Or do you still need a uniform distribution - Kromster

2 answers 2

Use seed ()

 import random import numpy as np random.seed(20) N = int(input() arr = np.array([random.random() for i in range(N)]) for i in range(N-1): arr = np.vstack((arr, np.array([random.random() for i in range(N)]))) print(arr) 

    As an option to create np.array:

     import numpy as np matrix = np.random.randint(maxVal, size=(rows, columns)) // от 0 до maxVal, rowsХcolumns 

    If you need to convert to list:

     matrix.tolist()