“matriz aleatoria NP” Código de respuesta

Matrix Python

np.random.rand(3,2)
Tremendous Enceladus

Generar Matriz Integer Random Python

import numpy as np

randi_arr = np.random.randint(start, end, dimensions)
#random integers will be sampled from [start, end) (end not inclusive)
#end is optional; if end is not specified, random integers will be sampled from [0, start) (start not inclusive)
#dimensions can be specified as shown here; (m,n) #2D array with size 'm x n'
Plain Pintail

matriz aleatoria NP

# uniform distribution over [0, 1)
np.random.rand(3, 3)
# [[0.20966286 0.72581506 0.78926387]
#  [0.85719525 0.00163033 0.45001818]
#  [0.17630303 0.40184026 0.89585902]]

# discrete uniform distribution in [0, 10)
np.random.randint(0, 10, size=[3,3])
# [[6 8 4]
#  [1 3 3]
#  [6 9 7]]

# normal distribution around 5 with standard deviation of 2
np.random.normal(5, 2, size=[3,3])
# [[3.8768528  5.73747086 3.63564872]
#  [5.49814587 2.62757122 3.61948982]
#  [3.36409537 7.86431236 5.16509868]]
M1k3y

Respuestas similares a “matriz aleatoria NP”

Preguntas similares a “matriz aleatoria NP”

Más respuestas relacionadas con “matriz aleatoria NP” en Python

Explore las respuestas de código populares por idioma

Explorar otros lenguajes de código