Python random.paretovariate() Examples

The following are code examples for showing how to use random.paretovariate(). They are extracted from open source Python projects. You can vote up the examples you like or vote down the ones you don't like. You can also save this page to your account.

Example 1
Project: zippy   Author: securesystemslab   File: crv_types.py    (license) View Source Project 5 votes vote down vote up
def sample(self):
        return random.paretovariate(self.alpha) 
Example 2
Project: Python-iBeacon-Scan   Author: NikNitro   File: crv_types.py    (license) View Source Project 5 votes vote down vote up
def sample(self):
        return random.paretovariate(self.alpha) 
Example 3
Project: HyperStream   Author: IRC-SPHERE   File: 2017-06-20_v1.0.0.py    (license) View Source Project 5 votes vote down vote up
def _execute(self, sources, alignment_stream, interval):
        if alignment_stream is None:
            raise ToolExecutionError("Alignment stream expected")

        for ti, _ in alignment_stream.window(interval, force_calculation=True):
            yield StreamInstance(ti, random.paretovariate(alpha=self.alpha)) 
Example 4
Project: shellcraft   Author: maebert   File: automata.py    (license) View Source Project 5 votes vote down vote up
def _resource_pr(self, resource, x, y, distance, deposit):
        seed("{}.{}".format(x, y))
        if resource == 'clay':
            v = paretovariate(2) / (distance + 1)
            return v if v > .2 else 0
        if resource == 'elevation':
            return paretovariate(4) / (distance + 1)
        if resource == 'ore':
            dx, dy, dr = deposit
            angle = math.atan2(dy - y, dx - x) % math.pi
            diff = .5 / (angle - dr + .5)
            v = paretovariate(2) / (distance + 1) * diff
            return v if v > .4 else 0