mirror of
https://github.com/1dot13/source.git
synced 2026-07-22 13:40:22 +02:00
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@2788 3b4a5df2-a311-0410-b5c6-a8a6f20db521
20 lines
547 B
C++
20 lines
547 B
C++
#include "Random.h"
|
|
#include <time.h>
|
|
|
|
UINT32 guiPreRandomIndex = 0;
|
|
std::vector<UINT32> guiPreRandomNums(MAX_PREGENERATED_NUMS, 0);
|
|
|
|
void InitializeRandom()
|
|
{
|
|
// Seed the random-number generator with current time so that
|
|
// the numbers will be different every time we run.
|
|
srand( (unsigned) time(NULL) );
|
|
|
|
//Pregenerate all of the random numbers.
|
|
for( guiPreRandomIndex = 0; guiPreRandomIndex < MAX_PREGENERATED_NUMS; guiPreRandomIndex++ )
|
|
{
|
|
guiPreRandomNums[ guiPreRandomIndex ] = rand();
|
|
}
|
|
guiPreRandomIndex = 0;
|
|
}
|