mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-02-28 02:53:49 +00:00
Engine directory for ticket #1
This commit is contained in:
parent
352279af7a
commit
7dbfe6994d
3795 changed files with 1363358 additions and 0 deletions
34
Engine/lib/opcode/Ice/IceRandom.cpp
Normal file
34
Engine/lib/opcode/Ice/IceRandom.cpp
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
/**
|
||||
* Contains code for random generators.
|
||||
* \file IceRandom.cpp
|
||||
* \author Pierre Terdiman
|
||||
* \date August, 9, 2001
|
||||
*/
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
#include "../Opcode.h"
|
||||
|
||||
using namespace IceCore;
|
||||
|
||||
void IceCore:: SRand(udword seed)
|
||||
{
|
||||
srand(seed);
|
||||
}
|
||||
|
||||
udword IceCore::Rand()
|
||||
{
|
||||
return rand();
|
||||
}
|
||||
|
||||
|
||||
static BasicRandom gRandomGenerator(42);
|
||||
|
||||
udword IceCore::GetRandomIndex(udword max_index)
|
||||
{
|
||||
// We don't use rand() since it's limited to RAND_MAX
|
||||
udword Index = gRandomGenerator.Randomize();
|
||||
return Index % max_index;
|
||||
}
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue