This commit is contained in:
2026-04-14 14:17:16 -04:00
parent caf347e8f5
commit 3afe18f188
41 changed files with 123 additions and 100 deletions

View File

@ -1,55 +0,0 @@
#ifndef __AMSCU_RANDOM_HPP__
#define __AMSCU_RANDOM_HPP__
namespace amscuda
{
// Random Number Gerneators
// faster floating point hash function used in fractal generators
__device__ __host__ float fhash1d_su(float x);
__device__ __host__ float fhash3d_su(float x, float y, float z);
__device__ __host__ float fhash4d_su(float x, float y, float z, float w);
//////////////////////////////////////////////////
// Deterministic Pseudorandom int32_t Generator //
//////////////////////////////////////////////////
//Next seed in simple 32 bit integer deterministic psuedo-rand generator
__host__ __device__ void dpr32_nextseed(int32_t *rseed_inout);
//Simple 32 bit integer deterministic pseudo-random generator
// *not* for cryptography
// Frequency of generated floats should be uniform [0,1)
__host__ __device__ float dpr32_randf(int32_t *rseed_inout);
//box muller standard normal pseudorandom variable
__host__ __device__ float dpr32_randnf(int32_t *rseed_inout);
//////////////////////////////////////////////////
// Deterministic Pseudorandom int64_t Generator //
//////////////////////////////////////////////////
//operates without side-effects on explicit seed for threaded use
//deterministic pseudorandom number generator - takes seed and returns next seed
__host__ __device__ void dpr64_nextseed(int64_t *seedinout);
//deterministic pseudorandom number generator - takes seed and returns next seed
//returns uniformly distributed double
__host__ __device__ double dpr64_randd(int64_t *seedinout);
__host__ __device__ float dpr64_randf(int64_t *seedinout);
void test_dprg64();
void test_dprg32();
}; //end namespace amscuda
#endif

View File

@ -39,8 +39,6 @@ namespace amscuda
//random device buffer functions
void dbuff_rand_dpr32(float *devbuffer, int N, int32_t *rseedinout, int nblocks, int nthreads); //
void dbuff_rand_dpr32n(float *devbuffer, int N, int32_t *rseedinout, int nblocks, int nthreads); //
void dbuff_rand_dpr64(float *devbuffer, int N, int64_t *rseedinout, int nblocks, int nthreads); //
//Elementwise device-buffer vector binary operation

View File

@ -50,7 +50,6 @@ namespace amscuda
#include <amsculib3/amscuarray.hpp>
#include <amsculib3/amscuda_binarrrw.hpp>
#include <amsculib3/amscu_random.hpp>
#include <amsculib3/random/amscurandom.cuh>

View File

@ -11,7 +11,12 @@ namespace fhash
{
//Floating point hash functions
// legacy fast floating point hash function used in fractal generators
__device__ __host__ float fhash1d_su(float x);
__device__ __host__ float fhash3d_su(float x, float y, float z);
__device__ __host__ float fhash4d_su(float x, float y, float z, float w);
};

View File

@ -11,7 +11,38 @@ namespace lcg
{
//Legacy linear congruential generators
//////////////////////////////////////////////////
// Deterministic Pseudorandom int32_t Generator //
//////////////////////////////////////////////////
//Next seed in simple 32 bit integer deterministic psuedo-rand generator
__host__ __device__ void dpr32_nextseed(int32_t *rseed_inout);
//Simple 32 bit integer deterministic pseudo-random generator
// *not* for cryptography
// Frequency of generated floats should be uniform [0,1)
__host__ __device__ float dpr32_randf(int32_t *rseed_inout);
//box muller standard normal pseudorandom variable
__host__ __device__ float dpr32_randnf(int32_t *rseed_inout);
//////////////////////////////////////////////////
// Deterministic Pseudorandom int64_t Generator //
//////////////////////////////////////////////////
//operates without side-effects on explicit seed for threaded use
//deterministic pseudorandom number generator - takes seed and returns next seed
__host__ __device__ void dpr64_nextseed(int64_t *seedinout);
//deterministic pseudorandom number generator - takes seed and returns next seed
//returns uniformly distributed double
__host__ __device__ double dpr64_randd(int64_t *seedinout);
__host__ __device__ float dpr64_randf(int64_t *seedinout);
void test_dprg64();
void test_dprg32();
};
};

View File

@ -48,6 +48,10 @@ __host__ int dbuff_randn(double *hbuffer, int64_t size, randstate_t *state = NUL
__host__ int dbuff_randint(int *hbuffer, int64_t size, int low, int high, randstate_t *state = NULL);
//Tests
__host__ void amscurand_tests1(); //test basic random functions
};
};