ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/rt/pmaprand.h
Revision: 2.4
Committed: Tue Aug 18 18:45:55 2015 UTC (8 years, 8 months ago) by greg
Content type: text/plain
Branch: MAIN
Changes since 2.3: +2 -1 lines
Log Message:
Added missing RCSid forgotten during initial check-in

File Contents

# Content
1 /* RCSid $Id$ */
2 #ifndef PMAPRAND_H
3 #define PMAPRAND_H
4
5 /*
6 ==================================================================
7 Random number generators for photon distribution
8
9 Roland Schregle (roland.schregle@{hslu.ch, gmail.com})
10 (c) Fraunhofer Institute for Solar Energy Systems,
11 (c) Lucerne University of Applied Sciences and Arts,
12 supported by the Swiss National Science Foundation (SNSF, #147053)
13 ==================================================================
14
15 $Id: pmaprand.h,v 2.3 2015/05/08 13:20:23 rschregle Exp $
16 */
17
18
19
20 /* According to the analytical validation, skipping numbers in the sequence
21 introduces bias in scenes with high reflectance. We therefore use
22 erand48() with separate states for photon emission, scattering, and
23 russian roulette. The pmapSeed() and pmapRandom() macros can be adapted
24 to other (better?) RNGs. */
25
26 #if defined(_WIN32) || defined(BSD)
27 /* Assume no erand48(), so use standard RNG without explicit multistate
28 control; the resulting sequences will be suboptimal */
29 #include "random.h"
30
31 #define pmapSeed(seed, state) (srandom(seed))
32 #define pmapRandom(state) (frandom())
33 #else
34 #define pmapSeed(seed, state) (state [0] += seed, state [1] += seed, \
35 state [2] += seed)
36 #define pmapRandom(state) erand48(state)
37 #endif
38
39
40 extern unsigned short partState [3], emitState [3], cntState [3],
41 mediumState [3], scatterState [3], rouletteState [3],
42 randSeed;
43
44 #endif
45