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
1afae373
Commit
1afae373
authored
Dec 22, 2014
by
Georgios Dagkakis
Committed by
Jérome Perrin
Feb 04, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cleanup in RandomNumberGenerator
parent
ca168320
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
2 deletions
+14
-2
dream/simulation/RandomNumberGenerator.py
dream/simulation/RandomNumberGenerator.py
+14
-2
No files found.
dream/simulation/RandomNumberGenerator.py
View file @
1afae373
...
@@ -29,8 +29,20 @@ holds methods for generations of numbers from different distributions
...
@@ -29,8 +29,20 @@ holds methods for generations of numbers from different distributions
import
math
import
math
class
RandomNumberGenerator
(
object
):
class
RandomNumberGenerator
(
object
):
def
__init__
(
self
,
obj
,
distribution
,
mean
=
0
,
stdev
=
0
,
min
=
0
,
max
=
0
,
alpha
=
0
,
beta
=
0
,
# data should be given as a dict:
logmean
=
0
,
logsd
=
0
,
probability
=
0
,
shape
=
0
,
scale
=
0
,
location
=
0
,
rate
=
0
,
**
kw
):
# "distribution": {
# "distributionType": {
# "mean": 10,
# "stdev": 1,
# "parameterX":X,
# ...
# },
def
__init__
(
self
,
obj
,
distribution
):
# pop irrelevant keys
for
key
in
distribution
.
keys
():
if
key
not
in
[
'Fixed'
,
'Normal'
,
'Exp'
,
'Gamma'
,
'Logistic'
,
'Erlang'
,
'Geometric'
,
'Lognormal'
,
'Weibull'
,
'Cauchy'
]:
distribution
.
pop
(
key
,
None
)
self
.
distribution
=
distribution
self
.
distribution
=
distribution
self
.
distributionType
=
distribution
.
keys
()[
0
]
self
.
distributionType
=
distribution
.
keys
()[
0
]
parameters
=
distribution
[
self
.
distributionType
]
parameters
=
distribution
[
self
.
distributionType
]
...
...
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