Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6535737
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T10:24:30+00:00 2026-05-25T10:24:30+00:00

i need a library with functions for generating random number, given average, standard deviation

  • 0

i need a library with functions for generating random number, given average, standard deviation and using one of three distribution – exponential, normal or unified.

even one of the three would help.
i’m looking for something like this – http://www.codeproject.com/KB/recipes/zigurat.aspx, but in c.

thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T10:24:30+00:00Added an answer on May 25, 2026 at 10:24 am

    uniform:

    Generate a random number in the range [0,1] with uniform distribution:

    double X=((double)rand()/(double)RAND_MAX);
    

    Exponentional

    generating an exponentional random variable with parameter lambda:

    -ln(U)/lambda (where U~Uniform[0,1]). 
    

    normal:

    the simplest way [though time consuming] is using the central limit theorem, [sum enough uniformly distributed numbers] but there are other methods in the wikipedia page such as the box muller transform that generates 2 independent random variables: X,Y~N(0,1)

    X=sqrt(-2ln(U))*cos(2*pi*V)
    Y=sqrt(-2ln(U))*sin(2*pi*V)
    where U,V~UNIFORM[0,1]
    

    transforming from X~N(0,1) to Z~N(m,s^2) is simple: Z = s*X + m

    Though you CAN generate these random numbers, I stand by @Amigable Clark Kant suggestion to use an existing library.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to call a library function that sometimes won't terminate within a given
I'm using the PRTools MATLAB library to train some classifiers, generating test data and
Buffer overrun problems are well known. Thus we were blessed with standard library functions
Basically I need some sort of library/set of functions that will allow me to
I need a library that allows me to do email operations(e.g Sent/Receive mail) in
I need a library that can detect objects in an image (uses edge detection).
I need a JavaScript library that supports Ajax as well as help me in
i need a C# library about strict HTML validation and filtering
I need a serialization library for .net with better features than the default xml
I need to build a C++ library to distribute among our customers. The library

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.