C/C++ create random noise (gaussian noise/white noise)

I was amazed when use randn command at Matlab. randn command will generate random data every we call that command. After I search at google, I found how to make this happen. I get this code at seismic unix source code. This code will generate random noise or white noise with Gaussian method. Code for main.c is :

This is code for frannor.h :

This is code for frannor.c :

To compile this source code, use command :

gcc main.c frannor.c -lm -o random

This is output from program :

Source : http://www.cwp.mines.edu/cwpcodes/index.html

One Comment

Add a Comment

Your email address will not be published. Required fields are marked *


This site uses Akismet to reduce spam. Learn how your comment data is processed.