Skip to content

Commit

Permalink
improve rand
Browse files Browse the repository at this point in the history
  • Loading branch information
waruqi committed May 22, 2024
1 parent be76595 commit 99e9476
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/tbox/platform/windows/random.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

0 comments on commit 99e9476

Please sign in to comment.