ReactOS
0.4.16-dev-981-g80eb313
Toggle main menu visibility
Main Page
Related Pages
Modules
Namespaces
Namespace List
Namespace Members
All
_
a
b
c
d
e
f
g
h
i
l
m
n
o
p
r
s
t
u
v
w
x
Functions
_
a
b
c
d
e
f
g
h
i
l
m
o
p
r
s
t
u
v
w
Variables
_
c
d
e
f
g
h
i
l
m
n
o
p
s
t
u
x
Typedefs
_
a
b
c
d
e
f
g
h
i
l
m
o
p
r
s
t
u
v
w
x
Enumerations
_
a
b
c
d
f
i
l
m
o
p
s
t
w
x
Enumerator
a
b
c
d
e
f
g
h
i
m
n
o
p
r
s
t
u
v
w
x
Classes
Class List
Class Index
Class Hierarchy
Class Members
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Enumerations
_
a
b
c
d
e
f
h
i
k
l
m
n
o
p
r
s
t
u
v
w
z
Enumerator
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Properties
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
Related Functions
_
a
b
c
d
e
f
g
h
i
l
m
n
o
p
q
r
s
t
v
x
Files
File List
File Members
All
$
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Functions
$
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Variables
$
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Enumerations
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Enumerator
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Macros
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Examples
rand.cpp
Go to the documentation of this file.
1
//
2
// rand.cpp
3
//
4
// Copyright (c) Microsoft Corporation. All rights reserved.
5
//
6
// Defines rand(), which generates psuedorandom numbers.
7
//
8
#include <
corecrt_internal.h
>
9
#include <stdlib.h>
10
11
12
13
// Seeds the random number generator with the provided integer.
14
extern
"C"
void
__cdecl
srand
(
unsigned
int
const
seed)
15
{
16
__acrt_getptd
()->
_rand_state
= seed;
17
}
18
19
20
21
// Returns a pseudorandom number in the range [0,32767].
22
extern
"C"
int
__cdecl
rand
()
23
{
24
__acrt_ptd
*
const
ptd
=
__acrt_getptd
();
25
26
ptd
->_rand_state =
ptd
->_rand_state * 214013 + 2531011;
27
return
(
ptd
->_rand_state >> 16) &
RAND_MAX
;
28
}
__cdecl
#define __cdecl
Definition:
accygwin.h:79
corecrt_internal.h
__acrt_getptd
__acrt_ptd *__cdecl __acrt_getptd(void)
Definition:
per_thread_data.cpp:298
ptd
_In_ size_t const _In_ int _In_ bool const _In_ unsigned const _In_ __acrt_rounding_mode const _Inout_ __crt_cached_ptd_host & ptd
Definition:
cvt.cpp:355
RAND_MAX
#define RAND_MAX
Definition:
stdlib.h:87
srand
void __cdecl srand(unsigned int const seed)
Definition:
rand.cpp:14
rand
int __cdecl rand()
Definition:
rand.cpp:22
__acrt_ptd
Definition:
corecrt_internal.h:865
__acrt_ptd::_rand_state
unsigned int _rand_state
Definition:
corecrt_internal.h:876
sdk
lib
ucrt
stdlib
rand.cpp
Generated on Wed Apr 16 2025 06:14:56 for ReactOS by
1.9.6