Thread: Gaussian Noise Generator

  1. #1
    Registered User
    Join Date
    Aug 2003
    Posts
    4

    Gaussian Noise Generator

    Hi guys,

    Does anyone know of a C function that will generate gaussian noise?

    Thanks in advance

  2. #2
    Guest Sebastiani's Avatar
    Join Date
    Aug 2001
    Location
    Waterloo, Texas
    Posts
    5,708
    >> Does anyone know of a C function that will generate gaussian noise?

    Yes.
    Code:
    #include <cmath>
    #include <complex>
    bool euler_flip(bool value)
    {
        return std::pow
        (
            std::complex<float>(std::exp(1.0)), 
            std::complex<float>(0, 1) 
            * std::complex<float>(std::atan(1.0)
            *(1 << (value + 2)))
        ).real() < 0;
    }

  3. #3
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  4. #4
    The superhaterodyne twomers's Avatar
    Join Date
    Dec 2005
    Location
    Ireland
    Posts
    2,273
    Generating Gaussian Random Numbers, Taygeta Scientific Inc.

    To change the standard deviation multiply by what you want it to be, and to change the mean add a new mean, I'd imagine.

  5. #5
    Registered User
    Join Date
    Aug 2003
    Posts
    4
    Quote Originally Posted by twomers View Post
    Generating Gaussian Random Numbers, Taygeta Scientific Inc.

    To change the standard deviation multiply by what you want it to be, and to change the mean add a new mean, I'd imagine.
    Thankyou kindly

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Procedural Noise and OpenGL Help!
    By Freestyler in forum C Programming
    Replies: 8
    Last Post: 04-18-2008, 08:06 AM
  2. Replies: 1
    Last Post: 09-04-2007, 05:31 AM
  3. NAQ: Everything you never wanted to know about CPP
    By evildave in forum C Programming
    Replies: 21
    Last Post: 12-12-2005, 10:56 AM
  4. Replies: 1
    Last Post: 03-17-2005, 08:53 AM
  5. written command line password generator
    By lepricaun in forum C Programming
    Replies: 15
    Last Post: 08-17-2004, 08:42 PM