/* ** Command & Conquer Renegade(tm) ** Copyright 2025 Electronic Arts Inc. ** ** This program is free software: you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with this program. If not, see . */ /*********************************************************************************************** *** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S *** *********************************************************************************************** * * * Project Name : Sampler * * * * $Archive:: /VSS_Sync/wwlib/sampler.cpp $* * * * Original Author:: Hector Yee * * * * $Author:: Vss_sync $* * * * $Modtime:: 8/29/01 10:25p $* * * * $Revision:: 1 $* * * *---------------------------------------------------------------------------------------------* * Functions: * * RandomSamplingClass::Sample -- Samples randomly over a hypercube using Mersenne Twister * * RegularSamplingClass::Sample -- Samples over a regular hypergrid * * StratifiedSamplingClass::Sample -- samples over a regular hypergrid with random offset * * QMCSamplingClass::Sample -- Samples using the Halton sequence * * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ // Use Random Sampling if you're not sure // Use Regular Sampling if you're not concerned about bias // Use Stratified Sampling if you want good results in low dimensions // Use QMC if you want low discrepancy and you want reproduceablility #include "sampler.h" #include "random.h" #include #include #include Random4Class Random; RandomSamplingClass::RandomSamplingClass(unsigned int dimensions,unsigned char divisions): SamplingClass(dimensions,divisions) { } /*********************************************************************************************** * RandomSamplingClass::Sample -- Samples randomly over a hypercube using Mersenne Twister * * * * * * * * * * INPUT: * * * * OUTPUT: * * * * WARNINGS: * * * * HISTORY: * * 6/11/2001 hy : Created. * *=============================================================================================*/ void RandomSamplingClass::Sample(float *target) { unsigned int i; for (i=0; i