 __device__ static unsigned long the_initial_seed = 0;
 __device__ static unsigned long step = 0;
 
+/* Max float precision */
+/* This is the max block size when drawing from a unique seed */
+#define MAXBLOCK (1<<24)
+
 /* Seeds */
 __host__ unsigned long THCRandom_seed()
 {

  long size = THCudaTensor_nElement(self);
  thrust::device_ptr<float> self_data(THCudaTensor_data(self));

  thrust::sequence(self_data, self_data+size, 0);
  thrust::transform(self_data, self_data+size, self_data, random1_functor(b,step));
  step+=size;

  THCudaTensor_freeCopyTo(self, self_);
};

  long size = THCudaTensor_nElement(self);
  thrust::device_ptr<float> self_data(THCudaTensor_data(self));
  
  while (true) {
      long bsize = size < MAXBLOCK ? size : MAXBLOCK;
      thrust::sequence(self_data, self_data+bsize, 0);
      thrust::transform(self_data, self_data+bsize, self_data, cauchy_functor(median,sigma,step));
      step+=bsize;
      self_data+=bsize;
      size-=bsize;
      if (bsize == 0) break;
  }

  THCudaTensor_freeCopyTo(self, self_);
};
