Code Search for Developers
 
 
  

NormalRandomWord.C from Magnus at Krugle


Show NormalRandomWord.C syntax highlighted

// Copyright (C) 1995 The New York Group Theory Cooperative
// See magnus/doc/COPYRIGHT for the full notice.

// Contents: Implementation of class NormalRandomWord.
//
// Principal Author: Roger Needham
//
// Status: Useable.
//
// Revision History:


#include "NormalRandomWord.h"


Word NormalRandomWord::word( )
{
  int len;
  do {
	 len = L.rand(mean, stddev);
  } while ( len < 1 );
  VectorOf<Generator> v(len);

  int i = 0;
  while ( i < len ) {
	 int gen;
	 do {
		gen = G.rand(-numGens, numGens);
	 } while ( gen == 0 );
	 if ( (i == 0) || (v[i] != -gen) ) v[i++] = gen;
  }
  return Word(v);
}




See more files for this project here

Magnus

Magnus is a special purpose mathematical package for Infinite Group Theory computations

Project homepage: http://sourceforge.net/projects/magnus
Programming language(s): C,C++
License: other

  AbelianWord.C
  Elt.C
  EltRep.C
  NormalRandomWord.C
  Word.C
  WordRep.C