Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

the partition function of a system is given by z= 1/(1-e^-bEi), calculate the total energy of the system

// random.cpp

// Linear congruential psuedo-random number generator.
// Generates psuedo-random sequence of integers in
//  range 0 .. RANDMAX. 

#define RANDMAX 6074  // RANDMAX = M - 1

int random (int seed = 0)
{
  static int next = 1;
  static int A = 106;
  static int C = 1283;
  static int M = 6075;

  if (seed) next = seed;
  next = next * A + C;
  return next % M;
}
Source by farside.ph.utexas.edu #
 
PREVIOUS NEXT
Tagged: #partition #function #system #calculate #total #energy #system
ADD COMMENT
Topic
Name
3+2 =