File indexing completed on 2026-04-09 07:49:33
0001 #pragma once
0002
0003 #if defined(__CUDACC__) || defined(__CUDABE__)
0004 #define SCURAND_METHOD __device__
0005 #include "curand_kernel.h"
0006 #else
0007 #define SCURAND_METHOD
0008 #include "srngcpu.h"
0009 #endif
0010
0011 template <typename T>
0012 struct scurand
0013 {
0014 static SCURAND_METHOD T uniform( RNG* rng );
0015 };
0016
0017
0018
0019 template<> inline float scurand<float>::uniform( RNG* rng )
0020 {
0021 #ifdef FLIP_RANDOM
0022 return 1.f - curand_uniform(rng) ;
0023 #else
0024 return curand_uniform(rng) ;
0025 #endif
0026 }
0027
0028 template<> inline double scurand<double>::uniform( RNG* rng )
0029 {
0030 #ifdef FLIP_RANDOM
0031 return 1. - curand_uniform_double(rng) ;
0032 #else
0033 return curand_uniform_double(rng) ;
0034 #endif
0035 }
0036
0037
0038