Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/ode/ode-0.9/OPCODE/Ice/IceRandom.cpp @ 216

Last change on this file since 216 was 216, checked in by mathiask, 16 years ago

[Physik] add ode-0.9

File size: 1.1 KB
Line 
1///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
2/**
3 *      Contains code for random generators.
4 *      \file           IceRandom.cpp
5 *      \author         Pierre Terdiman
6 *      \date           August, 9, 2001
7 */
8///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
9
10///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
11// Precompiled Header
12#include "Stdafx.h"
13
14using namespace IceCore;
15
16void IceCore::  SRand(udword seed)
17{
18        srand(seed);
19}
20
21udword IceCore::Rand()
22{
23        return rand();
24}
25
26
27static BasicRandom gRandomGenerator(42);
28
29udword IceCore::GetRandomIndex(udword max_index)
30{
31        // We don't use rand() since it's limited to RAND_MAX
32        udword Index = gRandomGenerator.Randomize();
33        return Index % max_index;
34}
35
Note: See TracBrowser for help on using the repository browser.