All Downloads are FREE. Search and download functionalities are using the official Maven repository.

kernels.float.uniform.cu Maven / Gradle / Ivy

There is a newer version: 0.4-rc3.7
Show newest version
#include 

extern "C"
__global__ void uniform_float(int n,float lower,float upper,float *randomNumbers, float *result) {
           int totalThreads = gridDim.x * blockDim.x;
           int tid = threadIdx.x;
            int i = blockIdx.x * blockDim.x + tid;

          for(; i < n; i += totalThreads) {
              float u = randomNumbers[i];
              result[i] = u * upper + (1 - u) * lower;
          }
}





© 2015 - 2024 Weber Informatics LLC | Privacy Policy