-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrand.pyx
More file actions
32 lines (27 loc) · 900 Bytes
/
rand.pyx
File metadata and controls
32 lines (27 loc) · 900 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
###cython: boundscheck=False, wraparound=False, nonecheck=False, cdivision=True, optimize.use_switch=True
try:
cimport cython
except ImportError:
print("\n<cython> library is missing on your system."
"\nTry: \n C:\\pip install cython on a window command prompt.")
# EXTERNAL C CODE
cdef extern from 'randnumber.c':
struct vector2d:
float x;
float y;
float randRangeFloat(float lower, float upper)nogil
int randRange(int lower, int upper)nogil
@cython.boundscheck(False)
@cython.wraparound(False)
@cython.nonecheck(False)
@cython.cdivision(True)
# RETURN RANDOMIZE INTEGER
cpdef randrange(a, b):
return randRange(a, b)
@cython.boundscheck(False)
@cython.wraparound(False)
@cython.nonecheck(False)
@cython.cdivision(True)
# RETURN RANDOMIZE FLOATING NUMBER
cpdef randrangefloat(a, b):
return randRangeFloat(a, b)