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