All pastes #817834 Raw Edit

Something

public cpp v1 · immutable
·published 2007-12-15 22:22 UTC
rendered paste body
#include <cstdlib> #include <ctime> #include <iostream>using namespace std;class Thread;Thread *threads[10];class Thread {public:	static int numThreads;	int myNum;	Thread * pickRandThread()	{		int x;		do			x = rand() % numThreads; 		while(myNum == x);		return getThread(x);	}	void receiveToken();	bool gotTokens();	Thread * getThread(int i);};int main(){	int flag = 0;	srand((unsigned)time(0));	Thread::numThreads = 10;	for (int i = 0; i < 10; i++)		threads[i] = new Thread(i);	return 0;}