Ejemplo n.º 1
0
 def test_rndint(self):
     """ test generator.rndint() """
     print("checking integers randomization")
     for index in range(1000):
         integer = int(generator.rndint(index))
         self.assert_(integer >= 0 and integer <= index * 2,
                      "size not expected")
     print("...integers randomization ok")
Ejemplo n.º 2
0
def generate_int():
    """
    Example which shows how to generate integers in a distribution between
    0 and 2 * given value.
    For more information:
        see Irwin-Hall in http://en.wikipedia.org/wiki/Normal_distribution
    """
    print("generating integers")
    index = 100
    for counter in range(1000):  # pylint: disable=W0612
        integer = generator.rndint(100)
        assert(integer >= 0 and integer <= index * 2)
    print("...integers generation OK!")