Skip to content

Commit bc16e44

Browse files
author
fuli
committed
fix a bug in RANDOM macro
1 parent 6d0105b commit bc16e44

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

include/generic.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
#define Min(a, b) ( (a < b) ? a : b )
2525

2626
#define RANDOM_INIT() srand(time(NULL))
27-
#define RANDOM(L, R) (L + rand() % ((R) - (L))) // gen a random integer in [L, R]
27+
#define RANDOM(L, R) (L + rand() % ((R) - (L) + 1)) // gen a random integer in [L, R]
2828

2929
namespace alg {
3030
/**

0 commit comments

Comments
 (0)