³ÑÆÄÀÌ random¹®À» ¾î¶»°Ô »ç¿ëÇÏ´ÂÁö ¾Ë¾Æ º»´Ù. ÆÄÀ̽㿡¼´Â ¹è¿ÀÇ Â÷¿øÀÇ Á¤º¸¸¦ shape¶ó ÇÑ´Ù. random((size)) 0ºÎ 1±îÁöÀÇ ¼Ò¼ö¸¦ ¹ÝȯÇÑ´Ù. size=(3, 2) Å©±âÀÇ ShapeÀÌ´Ù. import numpy as np
x = np.random.random((3, 2)) print(x) °á°ú) [[0.91552113 0.72432929] [0.22790641 0.17994582] [0.21705421 0.86838256]] (10,)Àº (10)°ú °°Àº shape ÇüÅÂÀÌ´Ù. import numpy as np
x = np.random.random((10,)) print(x) [0.3227275 0.72047267 0.4431706 0.01769559 0.90309143 0.42278237 0.26852485 0.36406231 0.65260438 0.56832204] randintÀÇ Ã¹¹ø° ¸Å°³º¯¼ö´Â ½ÃÀÛ°ª, µÎ¹ø° ¸Å°³º¯¼ö´Â ³¡°ª, ¼¼¹ø°´Â size´Â ¹è¿ÀÇ »çÀÌÁîÀÌ´Ù. import numpy as np
x = np.random.randint(0, 10, (3, 2)) print(x) °á°ú) [[3 6] [7 2] [9 0]] seed °ªÀ» 10À¸·Î ÁöÁ¤ÇÑ´Ù. 3°³ÀÇ ·£´ý°ªÀ» Ãâ·ÂÇÑ´Ù. import numpy as np
np.random.seed(10) x = np.random.random(3) print(x) °á°ú) [0.77132064 0.02075195 0.63364823] random(3)°ú random((3,))Àº °°Àº °ªÀ» Ãâ·ÂÇÑ´Ù. import numpy as np
np.random.seed(10) x = np.random.random((3,)) print(x) °á°ú) [0.77132064 0.02075195 0.63364823] Âü°í) Æ©Çà ¿ä¼Ò°¡ ÇϳªÀ϶§ Ç¥ÇöÀº (3, )¿Í °°´Ù. Æ©ÇÃÀº ½°Ç¥(,) ±âÈ£¸¦ ÀÌ¿ëÇÏ¿© ¸í½ÃÀûÀ¸·Î ¾Ë·ÁÁØ´Ù. |