# include "data.h"

int gaussdeviate (int argc, char **argv) {
  
  int i, Npts;
  double mean, sigma;
  Vector *vec;

  if (argc != 5) goto usage;

  if ((vec = SelectVector (argv[1], ANYVECTOR, TRUE)) == NULL) return (FALSE);    

  Npts = atoi (argv[2]);
  mean = atof (argv[3]);
  sigma = atof (argv[4]);

  vec[0].Nelements = Npts;
  REALLOCATE (vec[0].elements, float, Npts);

  gauss_init (2048);
  for (i = 0; i < Npts; i++) {
    vec[0].elements[i] = rnd_gauss (mean, sigma);
  }
  return (TRUE);

 usage:
  fprintf (stderr, "USAGE: gaussdeviate (vector) Npts mean sigma\n");
  return (FALSE);
    
}
