• Facebook
  • Twitter
  • Reddit
  • StumbleUpon
  • Digg
  • email

All Samples(694)  |  Call(533)  |  Derive(0)  |  Import(161)
Exponential distribution.

lambd is 1.0 divided by the desired mean.  It should be
nonzero.  (The parameter would be called "lambda", but that is
a reserved word in Python.)  Returned values range from 0 to
positive infinity if lambd is positive, and from negative
infinity to 0 if lambd is negative.

src/l/e/lepton-1.0b2/examples/fireworks.py   lepton(Download)
 
import os
import math
from random import expovariate, uniform, gauss
from pyglet import image
from pyglet.gl import *
 
def fire(dt=None):
	Kaboom()
	pyglet.clock.schedule_once(fire, expovariate(1.0 / (MEAN_FIRE_INTERVAL - 1)) + 1)
 
fire()
win.set_visible(True)
pyglet.clock.schedule_interval(default_system.update, (1.0/30.0))

src/l/e/lepton-1.0b2/examples/magnet.py   lepton(Download)
from lepton.emitter import StaticEmitter, PerParticleEmitter
from lepton.controller import Movement, Magnet, Collector, Lifetime, Fader
from lepton.domain import Sphere, Point, Disc
from random import expovariate
 
win = pyglet.window.Window(resizable=True, visible=False)
win.clear()
def summon(dt=None):
	if len(electrons) < max_electrons:
		electron_emitter.emit(1 ,electrons)
	pyglet.clock.schedule_once(summon, expovariate(1.0)+1.0)
 
summon()
 

src/s/i/simpy-HEAD/SimPy/SimPy/trunk/SimPyModels/bank08renege_OO.py   simpy(Download)
 from TheBank tutorial. (KGM)
"""
from SimPy.Simulation  import *
from random import expovariate, seed, uniform
 
## Model components ------------------------
 
    def generate(self,number,interval,counter):       
        for i in range(number):
            c = Customer(name = "Customer%02d"%(i,),sim=self.sim)
            self.sim.activate(c,c.visit(counter,timeInBank=12.0))
            t = expovariate(1.0/interval)
            yield hold,self,t
 
        if self.acquired(counter):
            wait = self.sim.now()-arrive
            print "%7.4f %s: Waited %6.3f"%(self.sim.now(),self.name,wait)
            tib = expovariate(1.0/timeInBank)            
            yield hold,self,tib                          
            yield release,self,counter
            print "%7.4f %s: Finished"%(self.sim.now(),self.name)

src/s/i/simpy-HEAD/SimPy/SimPy/trunk/SimPyModels/bank08renege.py   simpy(Download)
 from TheBank tutorial. (KGM)
"""
from SimPy.Simulation  import *
from random import expovariate, seed, uniform
 
## Model components ------------------------
 
    def generate(self,number,interval,counter):       
        for i in range(number):
            c = Customer(name = "Customer%02d"%(i,))
            activate(c,c.visit(counter,timeInBank=12.0))
            t = expovariate(1.0/interval)
            yield hold,self,t
 
        if self.acquired(counter):
            wait=now()-arrive
            print "%7.4f %s: Waited %6.3f"%(now(),self.name,wait)
            tib = expovariate(1.0/timeInBank)            
            yield hold,self,tib                          
            yield release,self,counter
            print "%7.4f %s: Finished"%(now(),self.name)

src/s/i/simpy-HEAD/SimPy/Python3/SimPyModels/bank08renege_OO.py   simpy(Download)
 from TheBank tutorial. (KGM)
"""
from SimPy.Simulation  import *
from random import expovariate, seed, uniform
 
## Model components ------------------------
 
    def generate(self,number,interval,counter):       
        for i in range(number):
            c = Customer(name = "Customer%02d"%(i,),sim=self.sim)
            self.sim.activate(c,c.visit(counter,timeInBank=12.0))
            t = expovariate(1.0/interval)
            yield hold,self,t
 
        if self.acquired(counter):
            wait = self.sim.now()-arrive
            print("%7.4f %s: Waited %6.3f"%(self.sim.now(),self.name,wait))
            tib = expovariate(1.0/timeInBank)            
            yield hold,self,tib                          
            yield release,self,counter
            print("%7.4f %s: Finished"%(self.sim.now(),self.name))

src/s/i/simpy-HEAD/SimPy/Python3/SimPyModels/bank08renege.py   simpy(Download)
 from TheBank tutorial. (KGM)
"""
from SimPy.Simulation  import *
from random import expovariate, seed, uniform
 
## Model components ------------------------
 
    def generate(self,number,interval,counter):       
        for i in range(number):
            c = Customer(name = "Customer%02d"%(i,))
            activate(c,c.visit(counter,timeInBank=12.0))
            t = expovariate(1.0/interval)
            yield hold,self,t
 
        if self.acquired(counter):
            wait=now()-arrive
            print("%7.4f %s: Waited %6.3f"%(now(),self.name,wait))
            tib = expovariate(1.0/timeInBank)            
            yield hold,self,tib                          
            yield release,self,counter
            print("%7.4f %s: Finished"%(now(),self.name))

src/s/i/simpy-HEAD/SimPy/SimPy/trunk/SimPyModels/bcc_OO.py   simpy(Download)
"""
 
from SimPy.Simulation import *
from random import seed,Random,expovariate,uniform
 
## Model components ------------------------
 
    """
    sum = 0.0 ; mu = K/mean
    for i in range(K):
        sum += expovariate(mu)
    return (sum)
 
def HyperVariate(p,m1,m2):
    g = rv to be used
    """
    if random() < p:
        return expovariate(1.0/m1)
    else: return expovariate(1.0/m2)
 
def testHyperVariate():
    def execute(self,JobRate,MaxJob,mu):
         global NoInService, Busy
         for i in range(MaxJob):         
             j = Job(sim=self.sim)
             self.sim.activate(j,j.execute(i,mu),delay=0.0)
             t = expovariate(JobRate)
             MT.tally(t)

src/s/i/simpy-HEAD/SimPy/SimPy/trunk/SimPyModels/bcc.py   simpy(Download)
"""
 
from SimPy.Simulation import *
from random import seed,Random,expovariate,uniform
 
## Model components ------------------------
 
    """
    sum = 0.0 ; mu = K/mean
    for i in range(K):
        sum += expovariate(mu)
    return (sum)
 
def HyperVariate(p,m1,m2):
    g = rv to be used
    """
    if random() < p:
        return expovariate(1.0/m1)
    else: return expovariate(1.0/m2)
 
def testHyperVariate():
    def execute(self,JobRate,MaxJob,mu):
         global NoInService, Busy
         for i in range(MaxJob):         
             j = Job()
             activate(j,j.execute(i,mu),delay=0.0)
             t = expovariate(JobRate)
             MT.tally(t)

src/s/i/simpy-HEAD/SimPy/Python3/SimPyModels/bcc_OO.py   simpy(Download)
"""
 
from SimPy.Simulation import *
from random import seed,Random,expovariate,uniform
 
## Model components ------------------------
 
    """
    sum = 0.0 ; mu = K/mean
    for i in range(K):
        sum += expovariate(mu)
    return (sum)
 
def HyperVariate(p,m1,m2):
    g = rv to be used
    """
    if random() < p:
        return expovariate(1.0/m1)
    else: return expovariate(1.0/m2)
 
def testHyperVariate():
    def execute(self,JobRate,MaxJob,mu):
         global NoInService, Busy
         for i in range(MaxJob):         
             j = Job(sim=self.sim)
             self.sim.activate(j,j.execute(i,mu),delay=0.0)
             t = expovariate(JobRate)
             MT.tally(t)

src/s/i/simpy-HEAD/SimPy/Python3/SimPyModels/bcc.py   simpy(Download)
"""
 
from SimPy.Simulation import *
from random import seed,Random,expovariate,uniform
 
## Model components ------------------------
 
    """
    sum = 0.0 ; mu = K/mean
    for i in range(K):
        sum += expovariate(mu)
    return (sum)
 
def HyperVariate(p,m1,m2):
    g = rv to be used
    """
    if random() < p:
        return expovariate(1.0/m1)
    else: return expovariate(1.0/m2)
 
def testHyperVariate():
    def execute(self,JobRate,MaxJob,mu):
         global NoInService, Busy
         for i in range(MaxJob):         
             j = Job()
             activate(j,j.execute(i,mu),delay=0.0)
             t = expovariate(JobRate)
             MT.tally(t)

  1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9  Next