Random number, array, vector, matrix, tensor generations using python, numpy, and random
I am going to use only one function for all of these.
I will generate random numbers between 0 and 1.
import numpy as np
number = numpy.random.uniform(0, 1)
array = numpy.random.uniform(0,1,n) # n is array size
matrix = numpy.random.uniform(0,1,(n,m)) # n x m matrix
Thanks,
JF
I will generate random numbers between 0 and 1.
import numpy as np
number = numpy.random.uniform(0, 1)
array = numpy.random.uniform(0,1,n) # n is array size
matrix = numpy.random.uniform(0,1,(n,m)) # n x m matrix
Thanks,
JF
댓글
댓글 쓰기