function WRANDN, seed, nrow, ncol ;+ ;NAME: ; WRANDN ; ;PURPOSE: ; To generate a matrix with ncol, nrow with normally distributed ; numbers. This function mimics the Matlab x=randn(size(A)) where ; size A gives you a 2-element array with values (nrow,ncol). ; ;CATEGORY: ; Simple math. ; ;CALLING SEQUENCE: ; rmatrix = WRANDN(seed, nrow, ncol) ; ;INPUTS: ; seed: Named variable containing the seed value for the random ; number generation. If it is undefined, it is derived from the ; system clock. ; nrow: number of rows ; ncol: number of columns ; ;OUTPUTS: ; A matrix w/ncol, nrow, normally distributed. ; ;NOTE: ; The easiest way to get the input rows/columns is to: ; IDL> t=SIZE(A) ; IDL> numcol = t(1) ;number of columns ; IDL> numrow=t(2) ;number of rows ; Or if A is an array: ; IDL> numcol = t(1) ;number of columns ; IDL> numrow=t(0) ;number of rows(=1) ; ;EXAMPLE: ; IDL> A = [[8,2,6],[3,6,7]] ; IDL>print, A ; 8 2 6 ; 3 6 7 ; IDL> t=SIZE(A) ; IDL> numcol = t(1) ;number of columns ; IDL> numrow=t(2) ;number of rows ; IDL> rmatrix = WRANDN(seed, nrow,ncol) ; IDL> print, rmatrix ; -0.323532 1.70055 -0.425996 ; -0.584817 -1.50207 1.04847 ; ;MODIFICATION HISTORY: ; Amara Graps September 1995. ; (c) copyright Amara Graps 1995, 1996. ;- rmatrix = RANDOMN(seed, ncol, nrow) RETURN, rmatrix END ;of function WRANDN