#include<boost/thread.hpp>
#include<iostream>
#include<cstdlib>
#include<ctime>

using namespace std;

double *a;
int rows;
int cols;
int nthreads;

void worker(int tid)
{
for(int i=tid;i<rows;i+=nthreads) {
	for(int j=0;j<cols;j++) {
          a[i*cols+j]=(double) rand()/(RAND_MAX*1.0);
          			}
          			 }
}
int main() {
	srand(time(0));
	rows=10;
	cols=10;
	nthreads=10;
	a=new double[rows*cols];
	boost::thread_group tg;
	for(int t=0;t<nthreads;t++)
	    tg.create_thread(boost::bind(worker,t));
	tg.join_all();
	for(int i=0;i<rows;i++)
	           {
		for(int j=0;j<cols;j++)
		{
		 cout<<a[i*cols+j]<<" ";
		   }
		 }
   
	   }

