numpy.random.standard_normal() function with example in python
numpy.random.standard_normal(): This function draw samples from a standard Normal distribution (mean=0, stdev=1).
Syntax: numpy.random.standard_normal(size=None)
Parameters:
size : int or tuple of ints, optional
Output shape. If the given shape is, e.g., (m, n, k), then m * n * k samples are drawn. Default is None, in which case a single value is returned.
Returns:
out : float or ndarray
Drawn samples.
import numpy as np
print(np.random.standard_normal(100))
print(np.random.standard_normal(size=(5, 8, 2)))
Output:
[-0.5291338 0.25114969 1.5378128 -1.63973282 1.0320552 -0.4202529 0.82406882 -0.29542388 -1.70828553 0.43826267 0.53104578 -1.13434012 -1.22876735 -1.08275008 1.40100994 0.41382866 1.55918235 -1.29533476 1.26030401 0.16943449 -1.58206014 1.79299528 -0.43173701 -0.03169446 -2.04257878 -0.22568208 2.07711057 0.39271192 0.96842642 -1.29769805 -0.17483238 -1.86381702 -0.69918152 -0.7101691 -1.98180982 -1.17651837 -0.81013536 -1.33946398 -1.76591403 -0.383698 -2.01547288 -0.73713832 -1.48717267 -0.77332307 -0.36504841 0.92279499 -0.70945953 -0.84383588 0.42332633 0.1986268 0.04934221 2.39169968 -0.05738675 0.24648873 0.30510696 -0.72184448 -0.32383144 1.40314784 -1.20228738 0.23947403 0.10805802 -0.35685451 0.37293493 1.01763145 1.69973757 -0.29910403 -0.38999096 -1.1027519 1.99383797 1.79398941 -1.01370388 -0.46235839 -0.30242576 -1.68309898 -0.29448376 0.70484318 0.8440772 -0.00269078 0.30639468 1.33555591 1.09814833 0.73708753 0.16217399 1.33920216 0.40461777 0.36144542 0.95019119 -1.52830426 -0.06823193 -2.08948367 -0.74505854 1.33995657 0.57730772 -1.39699287 0.01718719 -0.48423898 -1.59289307 1.23102743 -0.85701287 -1.14487056] [[[ 1.12046496 0.23176019] [-0.10172677 0.69678938] [ 0.66247166 1.4101414 ] [-0.44090584 1.01652444] [-0.53720987 0.2190571 ] [-1.23940663 1.54966558] [ 1.1925955 0.96589747] [ 0.35671816 -0.61092705]] [[ 0.30657018 -0.45851383] [ 1.31953118 -1.56726274] [-0.66369309 -0.18486426] [ 0.43927321 1.9200575 ] [ 0.81595253 -3.9343733 ] [ 0.47746047 -0.32715014] [-1.28496149 -0.566036 ] [ 2.09216743 -1.26436457]] [[ 0.29849938 -0.24528484] [ 0.90502069 1.14294902] [ 0.43418159 -0.86029091] [ 0.74588543 1.11033204] [-0.96354699 0.73395856] [-0.11290504 -0.57743276] [ 0.33851756 1.38407246] [ 0.61166654 0.08970228]] [[-1.48647914 -0.11698196] [ 1.47465211 0.02251731] [ 0.33026543 1.16178706] [-0.18313469 -0.04052182] [-0.07783125 1.11630188] [-0.75639937 1.71109761] [ 1.00641598 -0.04895828] [ 0.11304988 0.72099454]] [[ 0.01828176 1.38728875] [ 0.70672059 -0.10517591] [ 1.50041882 -0.45176001] [ 0.0585002 1.89378955] [ 0.61430977 -1.16487575] [ 0.33157504 -1.04717619] [ 0.87093577 -0.2909944 ] [ 1.80564515 0.22990392]]]