[DGD] Damage Weapons and Stuff (Math and Code)

Keith Dunwoody keithdunwoody at yahoo.com
Mon Jun 2 16:42:12 CEST 2003


As I believe someone already mentioned, I would really
recommend looking up Numerical Receipes in C (or
FORTRAN).  It has a lot of good stuff on the "proper"
way of simulating random experiments, and has how to
calculate a bunch of common functions (including I'm
sure the inverse error function).  I'd give you more
precise details, except my (dad's) copy of Numerical
Recepies is a few thousand miles away.

-- Keith

--- Ben Chambers <bjchamb at bellsouth.net> wrote:
> DGD would require me to write a table of values for
> cos and sin... wouldn't
> it?
> ----- Original Message -----
> From: "White, Ben" <ben.white at dsto.defence.gov.au>
> To: <dgd at list.imaginary.com>
> Sent: Monday, June 02, 2003 2:13 AM
> Subject: RE: [DGD] Damage Weapons and Stuff (Math
> and Code)
> 
> 
> >
> > You can generate gaussian distributed random
> numbers
> > with the following (assuming randf() generates a
> > uniformly distributed number between 0 and 1):
> >
> >   mag = sqrt (-2.0 * log10 (randf() + 1E-9));
> >   phase = 2.0 * pi * randf();
> >
> >   x = mag * cos (phase);
> >   y = mag * sin (phase);
> >
> > Both x and y will be normally distributed (mean 0,
> > std. dev 1).
> >
> > Another version that some people use is to add up
> > a whole bunch of uniformly distributed numbers. 
> It
> > works out very nicely if you use 12 numbers.  Eg:
> >
> >   sum = 0.0;
> >   for (i = 0; i < 12; i++) sum += randf();
> >   x = sum - 6.0;
> >
> > Hope this helps.
> > Ben White.
> >
> >
>
_________________________________________________________________
> > List config page: 
> http://list.imaginary.com/mailman/listinfo/dgd
> >
> 
>
_________________________________________________________________
> List config page: 
http://list.imaginary.com/mailman/listinfo/dgd


__________________________________
Do you Yahoo!?
Yahoo! Calendar - Free online calendar with sync to Outlook(TM).
http://calendar.yahoo.com
_________________________________________________________________
List config page:  http://list.imaginary.com/mailman/listinfo/dgd



More information about the DGD mailing list