#include "functionrandom.h" #include "gamestate.h" #include FunctionRandom::FunctionRandom() { } FunctionRandom::~FunctionRandom() { } void FunctionRandom::call( class GameState &gState ) { Variable vHigh = gState.popDeref(); Variable vLow = gState.popDeref(); if( vHigh.getType() != vLow.getType() ) throw Bu::ExceptionBase("Different types in random!"); if( vLow.getType() == Variable::tInt ) { gState.push( Variable( (int64_t)( (random()%(vHigh.getInt()-vLow.getInt()+1ll))+vLow.getInt() ) ) ); } }