POV-Ray : Newsgroups : povray.advanced-users : Normal distribution : Re: Normal distribution Server Time
28 Jul 2024 18:13:22 EDT (-0400)
  Re: Normal distribution  
From: Warp
Date: 5 May 2004 17:14:10
Message: <40995922@news.povray.org>
Andrew C on Mozilla <voi### [at] devnull> wrote:
> POV-Ray's random number generator gives uniformly distributed real numbers.

  Actually no. It gives uniformly distributed real numbers between 0 and 1,
which is a slightly different thing.

  (And we can also split hairs by noting that floating points numbers aren't
real numbers but a finite set of rational numbers, but would not be relevant
here... :) )

> Any idea how to transform these into normally distributed numbers?

  You can approximate a normal distribution of numbers between 0 and 1
by taking the sum of n equally-distributed numbers and dividing the
result by n. The higher the n, the more closely it resembles normal
distribution, but for practical purposes you don't need a very large n.
Even n=3 already gives a pretty good distribution.

-- 
#macro N(D)#if(D>99)cylinder{M()#local D=div(D,104);M().5,2pigment{rgb M()}}
N(D)#end#end#macro M()<mod(D,13)-6mod(div(D,13)8)-3,10>#end blob{
N(11117333955)N(4254934330)N(3900569407)N(7382340)N(3358)N(970)}//  - Warp -


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.