ReactOS 0.4.16-dev-2473-gb34a1f1
rand_s.c
Go to the documentation of this file.
1/*
2 * PROJECT: GCC C++ support library
3 * LICENSE: MIT (https://spdx.org/licenses/MIT)
4 * PURPOSE: Workaround for missing rand_s on pre-NT6 builds
5 * COPYRIGHT: Copyright 2026 Timo Kreuzer <timo.kreuzer@reactos.org>
6 */
7
8#include <stdlib.h>
9
10errno_t __cdecl rand_s(_Out_ unsigned int *RandomValue)
11{
12 if (!RandomValue)
13 return EINVAL;
14
15 *RandomValue = rand();
16 return 0;
17}
18
19#ifdef _M_IX86
20void* _imp__rand_s = rand_s;
21#else
23#endif
int errno_t
Definition: corecrt.h:249
#define __cdecl
Definition: corecrt.h:121
#define EINVAL
Definition: errno.h:44
_ACRTIMP int __cdecl rand(void)
Definition: misc.c:59
_ACRTIMP errno_t __cdecl rand_s(unsigned int *)
Definition: misc.c:72
#define _Out_
Definition: no_sal2.h:160
void * __imp_rand_s
Definition: rand_s.c:22