1 #ifndef RANDOMSAMPLEGENERATOR_HXX
 2 #define RANDOMSAMPLEGENERATOR_HXX
 3 
 4 #include "SampleGenerator.hxx"
 5 #include "Randomizer.hxx"
 6 
 7 class RandomSampleGenerator : public SampleGenerator 
 8 {
 9 	Randomizer randomizer;
10 public:
11 	virtual void GetSamples(int n, float *u, float *v, float *weight)
12 	{
13 		float stdweight = 1.0f / static_cast<float>(n);
14 
15 		for (int i = 0; i < n; ++i)
16 		{
17 			u[i]      = randomizer.drand();
18 			v[i]      = randomizer.drand();
19 			weight[i] = stdweight;
20 		}	
21 	};
22 
23 	virtual ~RandomSampleGenerator(){};
24 };
25 
26 #endif


syntax highlighted by Code2HTML, v. 0.9.1