static VALUE rb_gsl_rng_clone(VALUE obj) { gsl_rng *r = NULL, *rnew = NULL; Data_Get_Struct(obj, gsl_rng, r); rnew = gsl_rng_clone(r); return Data_Wrap_Struct(CLASS_OF(obj), 0, gsl_rng_free, rnew); }
GslRandomgen::GslRandomgen( const GslRandomgen& other ) { // the copy constructor defined = other.defined; myType = other.myType; mySeed = other.mySeed; if( other.me != NULL ) me = gsl_rng_clone (other.me); else me = NULL; }
GslRandomgen& GslRandomgen::operator= ( const GslRandomgen& other ) { // the assignment operator defined = other.defined; myType = other.myType; mySeed = other.mySeed; if( me != NULL ) { gsl_rng_free(me); me = NULL; } if( other.me != NULL ) { me = gsl_rng_clone(other.me); assert( me != NULL ); } else me = NULL; return *this; }
void* copy_state() { return gsl_rng_clone(rnd()); }