“Numpy Random int” Code-Antworten

Numpy Random int

np.random.randint(2, size=10) # Creates binary sample of size 10
np.random.randint(5, size=10) # Creates sample with 0-4 as values of size 10

np.random.randint(5, size=(2, 4))
Comfortable Cockroach

Generieren Sie eine zufällige Ganzzahl -Matrix 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

Ähnliche Antworten wie “Numpy Random int”

Fragen ähnlich wie “Numpy Random int”

Weitere verwandte Antworten zu “Numpy Random int” auf Python

Durchsuchen Sie beliebte Code-Antworten nach Sprache

Durchsuchen Sie andere Codesprachen