Example #1
0
File: rng.c Project: Fudge/rb-gsl
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);
}
Example #2
0
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;
}
Example #3
0
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;
}
Example #4
0
File: util.c Project: csail/airblue
void* copy_state()
{
    return gsl_rng_clone(rnd());
}