ReactOS
0.4.16-dev-1946-g52006dd
rand_s.cpp
Go to the documentation of this file.
1
//
2
// rand_s.cpp
3
//
4
// Copyright (c) Microsoft Corporation. All rights reserved.
5
//
6
// The implementation of the rand_s() function, which generates random numbers.
7
//
8
#include <
corecrt_internal.h
>
9
#include <stdlib.h>
10
11
12
13
extern
"C"
errno_t
__cdecl
rand_s
(
unsigned
int
*
const
result
)
14
{
15
_VALIDATE_RETURN_ERRCODE
(
result
!=
nullptr
,
EINVAL
);
16
*
result
= 0;
17
18
if
(!
__acrt_RtlGenRandom
(
result
,
static_cast<
ULONG
>
(
sizeof
(*
result
))))
19
{
20
errno
=
ENOMEM
;
21
return
errno
;
22
}
23
24
return
0;
25
}
EINVAL
#define EINVAL
Definition:
acclib.h:90
ENOMEM
#define ENOMEM
Definition:
acclib.h:84
__cdecl
#define __cdecl
Definition:
accygwin.h:79
corecrt_internal.h
result
GLuint64EXT * result
Definition:
glext.h:11304
_VALIDATE_RETURN_ERRCODE
#define _VALIDATE_RETURN_ERRCODE(expr, errorcode)
Definition:
internal_shared.h:143
rand_s
errno_t __cdecl rand_s(unsigned int *const result)
Definition:
rand_s.cpp:13
errno
#define errno
Definition:
errno.h:18
ULONG
uint32_t ULONG
Definition:
typedefs.h:59
errno_t
int errno_t
Definition:
corecrt.h:615
__acrt_RtlGenRandom
BOOLEAN WINAPI __acrt_RtlGenRandom(PVOID const buffer, ULONG const buffer_count)
Definition:
winapi_thunks.cpp:775
sdk
lib
ucrt
stdlib
rand_s.cpp
Generated on Thu Dec 4 2025 06:16:22 for ReactOS by
1.9.6