--- parser3/src/classes/Attic/random.C 2001/04/27 15:19:23 1.9.2.1 +++ parser3/src/classes/Attic/random.C 2001/04/28 08:43:48 1.10 @@ -5,7 +5,7 @@ Author: Alexander Petrosyan (http://design.ru/paf) - $Id: random.C,v 1.9.2.1 2001/04/27 15:19:23 paf Exp $ + $Id: random.C,v 1.10 2001/04/28 08:43:48 paf Exp $ */ #include "pa_config_includes.h" @@ -45,23 +45,21 @@ static void _generate(Request& r, const // constructor -MRandom::MRandom(Pool& pool, VStateless_class& vclass) { - set_name(NEW String(pool, RANDOM_CLASS_NAME)); +MRandom::MRandom(Pool& apool) : Methoded(apool) { + set_name(*NEW String(pool(), RANDOM_CLASS_NAME)); + // setting seed srand(getpid()+time(NULL)); rand(); + // ^random.generate[] // ^random.generate(range) add_native_method("generate", Method::CT_STATIC, _generate, 1, 1); } -// global variable - -Methoded *random_class; - // creator Methoded *MRandom_create(Pool& pool) { - return random_class=new(pool) MRandom(pool); + return new(pool) MRandom(pool); }