// file: $isip/class/algo/Generator/gen_06.cc
// version: $Id: gen_06.cc 8284 2002-07-04 01:51:05Z picone $
//

// isip include files
//
#include "Generator.h"

// method: setPhase
//
// arguments:
//  float phase: (input) phase value
//
// return: a boolean value indicating status
//
// this method sets the phase value
//
boolean Generator::setPhase(float phase_a) {

  // branch on the phase mode: RANDOM
  //
  if (phmode_d == RANDOM) {

    // initialize random generator
    //
    Random rand;
    rand.setAlgorithm(Random::UNIFORM);
    rand.setImplementation(Random::SUBTRACTIVE);
    rand.seed((long)seed_d);
    phase_d = rand.get() * 2.0 * Integral::PI;
  }

  // else: use the value as is
  //
  else {      
    phase_d = phase_a;
  }

  // exit gracefully
  //
  is_valid_d = false;
  return true;
}
