From 411732489a90de952b779ef5b8d1291fbb38f4f7 Mon Sep 17 00:00:00 2001
From: zhang <zhang@9a6e40ed-f3a0-4838-9b4a-bf418f78e88d>
Date: Tue, 15 Mar 2011 14:32:37 +0000
Subject: [PATCH] 15/03/2011

1) Add comments
---
 tracy/tracy/src/mathlib.cc | 103 +++++++++++++++++++++++++++++++++++++
 1 file changed, 103 insertions(+)

diff --git a/tracy/tracy/src/mathlib.cc b/tracy/tracy/src/mathlib.cc
index 86e318c..d84458e 100644
--- a/tracy/tracy/src/mathlib.cc
+++ b/tracy/tracy/src/mathlib.cc
@@ -39,15 +39,68 @@ void iniranf(const long i)
   rseed0 = i; rseed = i;
 }
 
+
 #define k               19
 #define c               656329L
 #define m               100000001
+/****************************************************************************/
+/* void newseed(void)
+
+   Purpose: define a new seed
+
+   input:
+       none
+
+   output:
+       none
+
+   return:
+       none
+
+   global variables:
+       rseed0
+       rseed
+       k, c, m
+
+   specific functions:
+       none
+
+   comments
+       none
+
+****************************************************************************/
 void newseed(void)
 {
 
   rseed0 = (k*rseed0+c) % m; rseed = (rseed0+54321) % m;
 }
+/****************************************************************************/
+/* double ranf(void)
+
+   Purpose: Generate a random number with rectangular distribution/uniform
+            distribution between the value [0, m]
+
+   input:
+       none
+
+   output:
+       none
+
+   return:
+       random number of type double
+
+   global variables:
+       rseed0
+       rseed
+       k, c, m
+
+   specific functions:
+       none
+
+   comments
+       none
 
+****************************************************************************/
 double ranf(void)
 {
   /* Generate random number with rectangular distribution */
@@ -58,7 +111,30 @@ double ranf(void)
 #undef c
 #undef m
 
+/****************************************************************************/
+/* void setrancut(double cut)
+
+   Purpose:   Set a cut for normal distribution
+
+   input:
+       cut : number of sigma for cutting the distribution
+
+   output:
+       none
+
+   return:
+       none
+
+   global variables:
+       normcut_
+
+   specific functions:
+       none
 
+   comments
+       none
+
+****************************************************************************/
 void setrancut(const double cut)
 {
 
@@ -68,7 +144,34 @@ void setrancut(const double cut)
   normcut_ = cut;
 }
 
+/****************************************************************************/
+/* double normranf(void)
+
+   Purpose:
+     Generate random numbers with Gaussian/normal distribution (m=0, sigma=1)
+     and cut normcut_ 
+
+   input:
+       none
+
+   output:
+       none
 
+   return:
+       random number 
+
+   global variables:
+       normcut_
+       maxiter
+
+   specific functions:
+       ranf
+
+   comments
+       none
+
+****************************************************************************/
+/* maximum number of iteration to generate the random number */
 #define maxiter         100 
 double normranf(void)
 {  
-- 
GitLab