Xyris
0.5
rand.hpp
Go to the documentation of this file.
1
/**
2
* @file rand.cpp
3
* @author Brian Kernighan, Dennis Ritchie (C Standard Authors)
4
* @author Michel (JMallone) Gomes (
[email protected]
)
5
* @brief Portable implementation of rand and srand as according to the C standard implementation by K&R.
6
* @version 0.1
7
* @date 2021-07-20
8
*
9
* @copyright C Programming Language copyright Brian Kernighan, Dennis Ritchie
10
* @copyright Implementation Copyright the Xyris Contributors (c) 2021.
11
*
12
* References:
13
* https://wiki.osdev.org/Random_Number_Generator#The_Standard.27s_Example
14
* https://pubs.opengroup.org/onlinepubs/9699919799/functions/rand.html
15
*
16
*/
17
#pragma once
18
#define MAX_RAND 32767
19
20
/**
21
* @brief Return a random value
22
*
23
* @return int Value from random number generator
24
*/
25
int
rand
(
void
);
26
27
/**
28
* @brief Set a seed to rand
29
*
30
* @param seed Random number generator seed
31
*/
32
void
srand
(
unsigned
int
seed);
srand
void srand(unsigned int seed)
Set a seed to rand.
Definition:
rand.cpp:28
rand
int rand(void)
Return a random value.
Definition:
rand.cpp:22
Kernel
Library
rand.hpp
Generated by
1.8.17