projects
/
BK-2020-03.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
doc(unitproc/.../sleepRand.py): Add comments
[BK-2020-03.git]
/
unitproc
/
python
/
sleepRand.py
diff --git
a/unitproc/python/sleepRand.py
b/unitproc/python/sleepRand.py
index 76a32e10172aa696e911e11a068817a3fe9d6c33..27e98d7d520b0ac511c413145e98814c949ba649 100755
(executable)
--- a/
unitproc/python/sleepRand.py
+++ b/
unitproc/python/sleepRand.py
@@
-1,6
+1,6
@@
#!/usr/bin/env python3
# Desc: Pauses a random amount of time. Random distribution is inverse gaussian.
#!/usr/bin/env python3
# Desc: Pauses a random amount of time. Random distribution is inverse gaussian.
-# Version: 0.0.
1
+# Version: 0.0.
2
# Depends: python 3.7.3
# Usage: ./sleepRand.py arg1
# Input: arg1: float seconds (mean of inverse gaussian distribution)
# Depends: python 3.7.3
# Usage: ./sleepRand.py arg1
# Input: arg1: float seconds (mean of inverse gaussian distribution)
@@
-11,6
+11,10
@@
import math, time, random, sys
# Define functions
def randInvGau(mu, lam):
"""Returns random variate of inverse gaussian distribution"""
# Define functions
def randInvGau(mu, lam):
"""Returns random variate of inverse gaussian distribution"""
+ # input: mu: mean of inverse gaussian distribution
+ # lam: shape parameter
+ # output: float sampled from inv. gaus. with range 0 to infinity, mean mu
+ # example: sample = float(randInvGau(1.0,4.0));
# Ref/Attrib: doi:10.1080/00031305.1976.10479147
nu = random.gauss(0,1);
y = nu ** 2;
# Ref/Attrib: doi:10.1080/00031305.1976.10479147
nu = random.gauss(0,1);
y = nu ** 2;
@@
-38,4
+42,5
@@
delay = randInvGau(desMean, desMean * lambdaFactor);
# Sleep
time.sleep(float(delay));
# Sleep
time.sleep(float(delay));
-
+# Author: Steven Baltakatei Sandoal
+# License: GPLv3+