Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

np.rand.randint

np.random.randint(0,10, size=(5, 5)) # random integers from 0 to 10 in size 5,5
#o/p 
array([[3, 9, 2, 3, 5],
       [2, 8, 7, 7, 1],
       [8, 2, 1, 1, 9],
       [9, 0, 5, 6, 4],
       [1, 6, 6, 4, 6]])
Comment

numpy randint

>>> np.random.randint(2, size=10)
array([1, 0, 0, 0, 1, 1, 0, 0, 1, 0]) # random
>>> np.random.randint(1, size=10)
array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0])
Comment

np.random.randint

# random.randint(low, high=None, size=None, dtype=int)
# [low,high) if high is given, else [0, low)
Comment

np.rand.randint

np.random.randint(0,10, size=(5, 5)) # random integers from 0 to 10 in size 5,5
#o/p 
array([[3, 9, 2, 3, 5],
       [2, 8, 7, 7, 1],
       [8, 2, 1, 1, 9],
       [9, 0, 5, 6, 4],
       [1, 6, 6, 4, 6]])
Comment

numpy randint

>>> np.random.randint(2, size=10)
array([1, 0, 0, 0, 1, 1, 0, 0, 1, 0]) # random
>>> np.random.randint(1, size=10)
array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0])
Comment

np.random.randint

# random.randint(low, high=None, size=None, dtype=int)
# [low,high) if high is given, else [0, low)
Comment

PREVIOUS NEXT
Code Example
Python :: how to import flask restful using pip 
Python :: Concatenate Item in list to strings 
Python :: how to replace first line of a textfile python 
Python :: python program for printing fibonacci numbers 
Python :: kfold cross validation sklearn 
Python :: convert a number column into datetime pandas 
Python :: python undefine variable 
Python :: new window selenium python 
Python :: python jokes 
Python :: apostrophe in python 
Python :: swap list items in python 
Python :: linear congruential generator in python 
Python :: pandas dataframe column names 
Python :: remove idx of list python 
Python :: generate a random number in python between 0 and 1 
Python :: create 2d array python list comprehension 
Python :: python selenium web scraping example 
Python :: how to load keras model from json 
Python :: python csv to list 
Python :: add custom field to serializer 
Python :: python currency sign 
Python :: python get os 
Python :: dict itterator python recursive 
Python :: python cut string after character 
Python :: how to download the captions of a youtube video 
Python :: python: calculate number of days from today date in a data frame 
Python :: how to use xpath with beautifulsoup 
Python :: pd df to series 
Python :: python remove empty list 
Python :: ImportError: No module named colored 
ADD CONTENT
Topic
Content
Source link
Name
9+4 =