   return weights;
 }
 
-__device__ float generate_randn(curandState* globalState) {
-  curandState localState = *globalState;
-  float RANDOM = curand_normal( &localState );
-  *globalState = localState;
-  return RANDOM;
-}
-
-__device__ float generate_rand(curandState* globalState) {
-  curandState localState = *globalState;
-  float RANDOM = curand_uniform( &localState );
-  *globalState = localState;
-  return RANDOM;
-}
-
 __global__ void setupCuRandState( curandState * state, unsigned long seed ) {
   int x = blockIdx.x*blockDim.x + threadIdx.x;
   curand_init ( seed, x, 0, &state[x] );

#include <curand.h>
#include <curand_kernel.h>
#define fill_bias(x) { fillLastColumnWith(x, 1.0f); }

void playground() {
  perf::Timer timer;
  timer.start();

  mat X(1024, 1024);
  for (int i=0; i<10000; ++i)
    addGaussian(X);

  timer.elapsed();

  // Prevent O3 optimization
  X.save("x.mat");
}

ostream& operator << (ostream& os, const RBM_TYPE& type) {
  switch (type) {


  int i = x * rows + y;
  int j = tx * blockDim.y + ty;
  data[i] = (float) (data[i] > curand_uniform(globalState + j));
  __syncthreads();
}

