src/math/random_generator.cpp File Reference

#include <assert.h>
#include <stdexcept>
#include <stdio.h>
#include <time.h>
#include "math/random_generator.hpp"

Go to the source code of this file.

Defines

#define NSHUFF   100

Functions

static __inline long good_rand (long x)

Variables

RandomGenerator graphicsRandom
RandomGenerator gameRandom


Define Documentation

#define NSHUFF   100

Referenced by RandomGenerator::srandom().


Function Documentation

static __inline long good_rand ( long  x  )  [static]

Definition at line 322 of file random_generator.cpp.

Referenced by RandomGenerator::random(), and RandomGenerator::srandom().

00323 {
00324   long hi, lo;
00325 
00326   // Can't be initialized with 0, so use another value.
00327   if (x == 0) x = 123459876;
00328   hi = x / 127773;
00329   lo = x % 127773;
00330   x = 16807 * lo - 2836 * hi;
00331   if (x < 0) x += 0x7fffffff;
00332   return x;
00333 }


Variable Documentation

RandomGenerator gameRandom

Definition at line 45 of file random_generator.cpp.

Referenced by FlyingSnowBall::activate(), Kugelblitz::active_update(), GhostTree::active_update(), FlyingSnowBall::active_update(), Candle::draw(), Kugelblitz::hit(), Main::init_rand(), Dispenser::launch_badguy(), scripting::play_demo(), PulsingLight::PulsingLight(), scripting::rand(), GameSession::restart_level(), SkullyHop::set_state(), Mole::throw_rock(), and Zeekling::Zeekling().

RandomGenerator graphicsRandom

Definition at line 44 of file random_generator.cpp.

Referenced by Stalactite::active_update(), CloudParticleSystem::CloudParticleSystem(), Firefly::collision(), Stumpy::collision_squished(), PoisonIvy::collision_squished(), MrTree::collision_squished(), CometParticleSystem::CometParticleSystem(), SkullTile::draw(), BrokenBrick::draw(), Explosion::explode(), get_random_color(), GhostParticleSystem::GhostParticleSystem(), Main::init_rand(), LevelIntro::LevelIntro(), Particles::Particles(), RainParticleSystem::RainParticleSystem(), SnowParticleSystem::SnowParticleSystem(), LevelIntro::update(), Wind::update(), SnowParticleSystem::update(), RainParticleSystem::update(), Player::update(), GhostParticleSystem::update(), Fireworks::update(), and CometParticleSystem::update().


Generated on Mon Jun 9 03:38:26 2014 for SuperTux by  doxygen 1.5.1