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

All Samples(2292)  |  Call(1933)  |  Derive(0)  |  Import(359)
x, random=random.random -> shuffle list x in place; return None.

Optional arg random is a 0-argument function returning a random
float in [0.0, 1.0); by default, the standard random.random.

src/b/r/brian-HEAD/trunk/examples/misc/pulsepacket.py   brian(Download)
'''
This example basically replicates what the Brian PulsePacket object does,
and then compares to that object.
'''
 
from brian import *
from random import gauss, shuffle
def pulse_packet(t, n, sigma):
    # generate a list of n times with Gaussian distribution, sort them in time, and
    # then randomly assign the neuron numbers to them
    times = [gauss(t, sigma) for i in range(n)]
    times.sort()
    neuron = range(n)
    shuffle(neuron)

src/b/r/brian-HEAD/examples/misc/pulsepacket.py   brian(Download)
'''
This example basically replicates what the Brian PulsePacket object does,
and then compares to that object.
'''
 
from brian import *
from random import gauss, shuffle
def pulse_packet(t, n, sigma):
    # generate a list of n times with Gaussian distribution, sort them in time, and
    # then randomly assign the neuron numbers to them
    times = [gauss(t, sigma) for i in range(n)]
    times.sort()
    neuron = range(n)
    shuffle(neuron)

src/p/y/pyevolve-HEAD/trunk/examples/pyevolve_ex21_nqueens.py   pyevolve(Download)
from pyevolve import G1DList
from pyevolve import Mutators, Crossovers
from pyevolve import Consts, GSimpleGA
from pyevolve import DBAdapters
from random import shuffle
 
# The "n" in n-queens
def queens_init(genome, **args):
   genome.genomeList = range(0, BOARD_SIZE)
   shuffle(genome.genomeList)
 
def run_main():
   genome = G1DList.G1DList(BOARD_SIZE)
   genome.setParams(bestrawscore=BOARD_SIZE, rounddecimal=2)

src/p/y/pyevolve-HEAD/examples/pyevolve_ex21_nqueens.py   pyevolve(Download)
from pyevolve import G1DList
from pyevolve import Mutators, Crossovers
from pyevolve import Consts, GSimpleGA
from pyevolve import DBAdapters
from random import shuffle
 
# The "n" in n-queens
def queens_init(genome, **args):
   genome.genomeList = range(0, BOARD_SIZE)
   shuffle(genome.genomeList)
 
def run_main():
   genome = G1DList.G1DList(BOARD_SIZE)
   genome.setParams(bestrawscore=BOARD_SIZE, rounddecimal=2)

src/p/y/pyjamas-0.7/examples/libtest/SetTest.py   Pyjamas(Download)
from UnitTest import UnitTest
from random import randrange, shuffle
 
 
class PassThru(Exception):
    pass
 
        seq = [randrange(n) for i in xrange(n)]
        results = set()
        for i in xrange(200):
            shuffle(seq)
            results.add(hash(self.thetype(seq)))
        self.assertEqual(len(results), 1)
 

src/o/b/OBITools-0.2.100/src/obitools/sample.py   OBITools(Download)
'''
Created on 31 oct. 2009
 
@author: coissac
'''
from random import shuffle, randrange
 
def weigthedSample(events,size):
    entries = [k for k in events.iterkeys() if events[k]>0]
    shuffle(entries)
    cumul=[]
    s=0
    for e in entries:
        s+=events[e]

src/p/y/PyAMF-HEAD/doc/tutorials/examples/gateways/turbogears/mygateway.py   PyAMF(Download)
    def scramble(self, text):
        from random import shuffle
        s = [x for x in text]
        shuffle(s)
        return ''.join(s)
 
 

src/k/a/kamaelia-HEAD/trunk/Sketches/RJL/bittorrent/BitTorrent/BitTorrent/PiecePicker.py   kamaelia(Download)
 
# Written by Bram Cohen
 
from random import randrange, shuffle, choice
 
 
class PiecePicker(object):
        self.seedstarted = []
        self.numgot = 0
        self.scrambled = range(numpieces)
        shuffle(self.scrambled)
 
    def got_have(self, piece):
        numint = self.numinterests[piece]

src/k/a/kamaelia-HEAD/Sketches/RJL/bittorrent/BitTorrent/BitTorrent/PiecePicker.py   kamaelia(Download)
 
# Written by Bram Cohen
 
from random import randrange, shuffle, choice
 
 
class PiecePicker(object):
        self.seedstarted = []
        self.numgot = 0
        self.scrambled = range(numpieces)
        shuffle(self.scrambled)
 
    def got_have(self, piece):
        numint = self.numinterests[piece]

src/b/t/btqueue-HEAD/trunk/btqueue/BitTorrent/PiecePicker.py   btqueue(Download)
 
# Written by Bram Cohen
 
from random import randrange, shuffle, choice
 
 
class PiecePicker(object):
        self.seedstarted = []
        self.numgot = 0
        self.scrambled = range(numpieces)
        shuffle(self.scrambled)
 
    def got_have(self, piece):
        numint = self.numinterests[piece]

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