Commit 1afae373 authored by Georgios Dagkakis's avatar Georgios Dagkakis Committed by Jérome Perrin

cleanup in RandomNumberGenerator

parent ca168320
...@@ -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]
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment