본문 바로가기
언어/ㄴPython

[python] generating random array

by 공대우냉이 2016. 1. 21.

랜덤 array 생성하기.

This Command is to generate random array in python interpreter.

>>>z=numpy.asarray(numpy.random.RandomState(x).uniform(low=a, high=b, size=length))

or

>>>rng=numpy.random.RandomState(x)

>>>z=numpy.asarray(rng.uniform(low=a, high=b, size=length))

>>>z

output is

array([ the number of length of random unit ])

 

length개의 random unit이 생산된다.

범위는 a~b까지 인데 (a,b)인지 [a,b]인지 확인은 하지 못하였다.

그리고 x의 값이 같으면 위와 같은 command를 쳐도 항상 같은 random array를 생성한다.

x는 Randomstate로 x값을 바꿔 생성되는 random 값의 상태를 정한다.

 

That's array ranges from a to b and I'm not sure that It has a,b values, hasn't a,b values.

the variable x is random state that set random values.

If x is same value, The array has a previous same array, nevertheless, the command is  repeatedly typed in interpreter.