 	dim3 grid((currentMapSize[0]*currentMapSize[1]-1)/NUMTHREADS+1, 1, 1);
 	dim3 threads(NUMTHREADS, 1, 1);
 	for(int j = 0; j < information.NumberOfDimensions; j++ ){
-		SetBufferToConstant<<<grid, threads, 0, *stream>>>(device_KohonenMap+(2*j)*currMapSize, (float)(0.5*(range[2*j+1]+range[2*j])), currMapSize);
+		SetBufferToRandom<<<grid, threads, 0, *stream>>>(device_KohonenMap+(2*j)*currMapSize, (float) range[2*j+1], (float) range[2*j], currMapSize);
 		SetBufferToConstant<<<grid, threads, 0, *stream>>>(device_KohonenMap+(2*j+1)*currMapSize, information.Weights[j], currMapSize);
 	}
 

#include <stdio.h>
#include <time.h>

#define DEBUGGING

//parameters held in constant memory

	if( currentMapSize[0] > information.KohonenMapSize[0] ) currentMapSize[0] = information.KohonenMapSize[0];
	while( neighbourhood * (double) currentMapSize[1] < 8.0 && currentMapSize[1] < information.KohonenMapSize[1] ) currentMapSize[1] += currentMapSize[1];
	if( currentMapSize[1] > information.KohonenMapSize[1] ) currentMapSize[1] = information.KohonenMapSize[1];
	#ifdef DEBUGGING
		printf("Updating size to (%d,%d)\n", currentMapSize[0],currentMapSize[1]);
	#endif

	//allocate a distance buffer
	float* device_DistanceBuffer1 = 0;
