Changeset 997 for trunk

Show
Ignore:
Timestamp:
10/03/11 17:06:43 (8 months ago)
Author:
apdavison
Message:

AbstractRNG is now a new-style class (ticket:194)

Location:
trunk
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/common.py

    r993 r997  
    328328        Connect a source of spikes to a synaptic target. 
    329329 
    330         source and target can both be individual cells or lists of cells, in 
    331         which case all possible connections are made with probability p, using 
    332         either the random number generator supplied, or the default rng 
    333         otherwise. Weights should be in nA or µS. 
     330        source and target can both be individual cells or populations/assemblies 
     331        of cells, in which case all possible connections are made with 
     332        probability p, using either the random number generator supplied, or the 
     333        default rng otherwise. Weights should be in nA or µS. 
    334334        """ 
    335335        if isinstance(source, IDMixin): 
  • trunk/src/random.py

    r980 r997  
    4242logger = logging.getLogger("PyNN") 
    4343  
    44 class AbstractRNG: 
     44class AbstractRNG(object): 
    4545    """Abstract class for wrapping random number generators. The idea is to be 
    4646    able to use either simulator-native rngs, which may be more efficient, or a 
  • trunk/test/unittests/test_random.py

    r818 r997  
    168168                                       rng=self.rnglist[0], boundaries=[0.0, 1.0], 
    169169                                       constrain="clip") 
    170         vals = rd.next(100) 
     170        vals = rd.next(1000) 
    171171        assert vals.min() == 0 
    172172        assert vals.max() < 1.0 
     
    175175                                       rng=self.rnglist[0], boundaries=[0.0, 1.0], 
    176176                                       constrain="redraw") 
    177         vals = rd.next(100) 
     177        vals = rd.next(1000) 
    178178        assert vals.min() >= 0 
    179179        assert vals.max() < 1.0 
    180         assert abs(vals.mean() - 0.5) < 0.05 
     180        assert abs(vals.mean() - 0.5) < 0.05, vals.mean() 
    181181        val = rd.next() 
    182182        rd = random.RandomDistribution(distribution='uniform', parameters=[-1.0, 1.0],