comparison pytouhou/utils/random.pyx @ 616:4ce3ef053a25

Remove every case where an exception could be silently eaten by a cdef function.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Sat, 28 Mar 2015 23:21:15 +0100
parents 292fea5c584e
children
comparison
equal deleted inserted replaced
615:d1f0bb0b7a17 616:4ce3ef053a25
23 It has been reverse engineered from 102h.exe.""" 23 It has been reverse engineered from 102h.exe."""
24 24
25 25
26 #TODO: maybe some post-processing is missing 26 #TODO: maybe some post-processing is missing
27 27
28 28 cimport cython
29 from time import time 29 from time import time
30 30
31
32 @cython.final
31 cdef class Random: 33 cdef class Random:
32 def __init__(self, long seed=-1): 34 def __init__(self, long seed=-1):
33 if seed < 0: 35 if seed < 0:
34 seed = time() 36 seed = time()
35 self.set_seed(<unsigned short>(seed & 65535)) 37 self.set_seed(<unsigned short>(seed & 65535))