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
df7a90e1
Commit
df7a90e1
authored
Dec 23, 2014
by
Georgios Dagkakis
Committed by
Ioannis Papagiannopoulos
Jan 06, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
RandomNumberGenerator to require distribution to be given as dictionary
parent
2809d359
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
2 deletions
+5
-2
dream/simulation/RandomNumberGenerator.py
dream/simulation/RandomNumberGenerator.py
+4
-1
dream/tests/testRandomNumberGenerator.py
dream/tests/testRandomNumberGenerator.py
+1
-1
No files found.
dream/simulation/RandomNumberGenerator.py
View file @
df7a90e1
...
...
@@ -38,7 +38,10 @@ class RandomNumberGenerator(object):
# ...
# },
def
__init__
(
self
,
obj
,
distribution
):
# check in case an inknown distrbution was given
# if the distribution is not given as a dictionary throw error
if
not
isinstance
(
distribution
,
dict
):
raise
ValueError
(
"distribution must be given as a dict"
)
# check in case an unknown distribution was given
unknownDistribution
=
True
for
key
in
distribution
.
keys
():
if
key
in
[
'Fixed'
,
'Normal'
,
'Exp'
,
'Gamma'
,
'Logistic'
,
'Erlang'
,
...
...
dream/tests/testRandomNumberGenerator.py
View file @
df7a90e1
...
...
@@ -67,7 +67,7 @@ class RandomNumberGeneratorTestCase(TestCase):
})
self
.
assertRaises
(
ValueError
,
rng
.
generateNumber
)
def
testUnk
on
wnDistribution
(
self
):
def
testUnk
no
wnDistribution
(
self
):
rng
=
RandomNumberGenerator
(
obj
,
distribution
=
'Unknown'
)
self
.
assertRaises
(
ValueError
,
rng
.
generateNumber
)
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