From 99e947693bcd0ca3feb14f600397a81a1bfc4524 Mon Sep 17 00:00:00 2001 From: ruki Date: Wed, 22 May 2024 23:56:53 +0800 Subject: [PATCH] improve rand --- src/tbox/platform/windows/random.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/tbox/platform/windows/random.c b/src/tbox/platform/windows/random.c index 90ed7a41d..c57b62981 100644 --- a/src/tbox/platform/windows/random.c +++ b/src/tbox/platform/windows/random.c @@ -35,8 +35,12 @@ tb_void_t tb_random_seed(tb_size_t seed) } tb_long_t tb_random_value() { +#ifdef TB_COMPILER_IS_CLANG + return (tb_long_t)rand(); +#else tb_uint_t number = 0; if (rand_s(&number) == 0) return (tb_long_t)number; else return 0; +#endif }