ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/px/brandom.c
Revision: 1.3
Committed: Fri Nov 5 03:31:38 2004 UTC (19 years, 6 months ago) by greg
Content type: text/plain
Branch: MAIN
CVS Tags: HEAD
Changes since 1.2: +1 -1 lines
State: FILE REMOVED
Log Message:
Removed unused programs and files from distribution (sources to CVS attic)

File Contents

# Content
1 #ifndef lint
2 static const char RCSid[] = "$Id: brandom.c,v 1.2 2003/02/22 02:07:27 greg Exp $";
3 #endif
4 /*
5 * brandom.c - blue noise function.
6 *
7 * 11/8/87
8 */
9
10 #include "random.h"
11
12
13 double
14 brandom(l) /* blue noise function */
15 int l; /* length between 1 and 8 */
16 {
17 static float his[8] = {.5,.5,.5,.5,.5,.5,.5,.5};
18 static double avg = .5;
19 static int x = 0;
20 double y = frandom();
21
22 if (avg < .5)
23 y = 1 - 2*y*avg;
24 else
25 y = 2*y*(1 - avg);
26 /* update */
27 avg += (y - his[x])/l;
28 his[x] = y;
29 if (++x >= l) x = 0;
30
31 return(y);
32 }