Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
dream
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
dream
Commits
15c8c6ed
Commit
15c8c6ed
authored
Oct 21, 2014
by
Georgios Dagkakis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
some distributions added
parent
e6365c6e
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
4 deletions
+10
-4
dream/simulation/RandomNumberGenerator.py
dream/simulation/RandomNumberGenerator.py
+10
-4
No files found.
dream/simulation/RandomNumberGenerator.py
View file @
15c8c6ed
...
...
@@ -65,16 +65,22 @@ class RandomNumberGenerator(object):
elif
self
.
distributionType
==
"Erlang"
:
#if the distribution is erlang
return
G
.
Rnd
.
gammavariate
(
self
.
alpha
,
self
.
beta
)
elif
(
self
.
distributionType
==
"Logistic"
):
#if the distribution is Logistic
return
1
# XXX from http://stackoverflow.com/questions/3955877/generating-samples-from-the-logistic-distribution
# to check
from
random
import
random
import
math
x
=
random
()
return
self
.
location
+
self
.
scale
*
math
.
log
(
x
/
(
1
-
x
))
elif
(
self
.
distributionType
==
"Geometric"
):
#if the distribution is Geometric
return
1
elif
(
self
.
distributionType
==
"Lognormal"
):
#if the distribution is Lognormal
return
1
# XXX from the files lognormvariate(mu, sigma)
# it would be better to use same mean,stdev
return
G
.
Rnd
.
lognormvariate
(
self
.
logmean
,
self
.
logsd
)
elif
(
self
.
distributionType
==
"Weibull"
):
#if the distribution is Weibull
return
1
return
G
.
Rnd
.
weibullvariate
(
self
.
scale
,
self
.
shape
)
elif
(
self
.
distributionType
==
"Cauchy"
):
#if the distribution is Cauchy
return
1
else
:
raise
ValueError
(
"Unknown distribution %r used in %s %s"
%
(
self
.
distributionType
,
self
.
obj
.
__class__
,
self
.
obj
.
id
))
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment