Gamma distribution in C#?

This is a discussion on Gamma distribution in C#? within the C# Programming forums, part of the General Programming Boards category; Hi all, I'm looking for any helpful info, links, possibly libraries on getting random numbers from gamma distributions in C#... ...

  1. #1
    Use this: dudeomanodude's Avatar
    Join Date
    Jan 2008
    Location
    Hampton, VA
    Posts
    391

    Gamma distribution in C#?

    Hi all,

    I'm looking for any helpful info, links, possibly libraries on getting random numbers from gamma distributions in C#...

    I'm familiar with using normal distributions and can easily convert what I have in C++ to C# but for gamma distributions i have nothing and won't be able to dll any of the c++ gamma stuff i've found...

    any help is most appreciated!

    Thanks in advance.

    EDIT: Any random number info for C# will also be helpful.
    Ubuntu Desktop
    GCC/G++
    Geany (for quick projects)
    Anjuta (for larger things)

  2. #2
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,185
    C# has a Random class that you can instantiate to get a RNG, something like
    Code:
    Random my_numbers = new Random();
    You can then say
    Code:
    cdf = my_numbers.NextDouble();
    to get a uniform distribution between 0 and 1. If you have a transform for a uniform distribution to a gamma distribution, then you're golden. (I'd have to look at what the gamma distribution is to know.)

  3. #3
    Use this: dudeomanodude's Avatar
    Join Date
    Jan 2008
    Location
    Hampton, VA
    Posts
    391
    C# has a Random class that you can instantiate to get a RNG, something like
    Code:

    Random my_numbers = new Random();

    You can then say
    Code:

    cdf = my_numbers.NextDouble();

    to get a uniform distribution between 0 and 1. If you have a transform for a uniform distribution to a gamma distribution, then you're golden. (I'd have to look at what the gamma distribution is to know.)
    Actually the gamma dist for these electronics parts (and more importantly they're MTBF) will be supplied to me (and thankfully so), I'll be dealing more with analyzing that data for cost-effectiveness purposes. Only thing is i'm at a stand still until that portion of the code comes back from our contractor, so I was just looking for something quick that I could start writing my portion of the program.

    I suppose it doesn't really matter if I use some other distribution to do my stuff, but then i don't know how that might effect things down the road...
    Ubuntu Desktop
    GCC/G++
    Geany (for quick projects)
    Anjuta (for larger things)

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. RTTI for distribution
    By coletek in forum C++ Programming
    Replies: 6
    Last Post: 09-13-2010, 10:05 AM
  2. Gamma rays - need refreshing for exam
    By Akkernight in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 06-03-2009, 02:36 PM
  3. Which distribution of Linux should I get?
    By joshdick in forum A Brief History of Cprogramming.com
    Replies: 50
    Last Post: 01-19-2003, 08:26 AM
  4. fopen();
    By GanglyLamb in forum C Programming
    Replies: 8
    Last Post: 11-03-2002, 11:39 AM
  5. Replies: 5
    Last Post: 10-12-2001, 03:51 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21