ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/rt/pmaprand.h
Revision: 2.6
Committed: Sun Mar 6 01:13:18 2016 UTC (8 years, 2 months ago) by schorsch
Content type: text/plain
Branch: MAIN
Changes since 2.5: +2 -2 lines
Log Message:
Prepare for SCons build on Win32 and Win64

File Contents

# User Rev Content
1 schorsch 2.6 /* RCSid $Id: pmaprand.h,v 2.5 2015/09/01 16:27:53 greg Exp $ */
2 greg 2.1 #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 rschregle 2.3 (c) Lucerne University of Applied Sciences and Arts,
12     supported by the Swiss National Science Foundation (SNSF, #147053)
13 greg 2.1 ==================================================================
14    
15     */
16    
17    
18    
19     /* According to the analytical validation, skipping numbers in the sequence
20     introduces bias in scenes with high reflectance. We therefore use
21     erand48() with separate states for photon emission, scattering, and
22     russian roulette. The pmapSeed() and pmapRandom() macros can be adapted
23     to other (better?) RNGs. */
24 greg 2.2
25 schorsch 2.6 #if defined(_WIN32) || defined(_WIN64) || defined(BSD)
26 greg 2.2 /* Assume no erand48(), so use standard RNG without explicit multistate
27     control; the resulting sequences will be suboptimal */
28     #include "random.h"
29 greg 2.1
30 greg 2.2 #define pmapSeed(seed, state) (srandom(seed))
31     #define pmapRandom(state) (frandom())
32     #else
33     #define pmapSeed(seed, state) (state [0] += seed, state [1] += seed, \
34     state [2] += seed)
35     #define pmapRandom(state) erand48(state)
36     #endif
37 greg 2.1
38    
39     extern unsigned short partState [3], emitState [3], cntState [3],
40     mediumState [3], scatterState [3], rouletteState [3],
41     randSeed;
42    
43     #endif
44 greg 2.2