| 1 |
|
/* RCSid $Id$ */ |
| 2 |
– |
#ifndef PMAPRAND_H |
| 3 |
– |
#define PMAPRAND_H |
| 2 |
|
|
| 3 |
|
/* |
| 4 |
|
================================================================== |
| 10 |
|
supported by the Swiss National Science Foundation (SNSF, #147053) |
| 11 |
|
================================================================== |
| 12 |
|
|
| 13 |
+ |
$Id$ |
| 14 |
|
*/ |
| 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 |
| 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. */ |
| 18 |
> |
#ifndef PMAPRAND_H |
| 19 |
> |
#define PMAPRAND_H |
| 20 |
|
|
| 21 |
< |
#if defined(_WIN32) || defined(_WIN64) || defined(BSD) |
| 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; |
| 42 |
< |
|
| 40 |
> |
|
| 41 |
> |
extern unsigned short partState [3], emitState [3], cntState [3], |
| 42 |
> |
mediumState [3], scatterState [3], rouletteState [3], |
| 43 |
> |
randSeed; |
| 44 |
|
#endif |
| 45 |
|
|