mirror of
https://gitlab.nic.cz/labs/bird.git
synced 2024-12-22 09:41:54 +00:00
Split random number functions off io.c, so that they can be documented
separately.
This commit is contained in:
parent
5cc1e1f805
commit
10304bed43
@ -1,4 +1,4 @@
|
|||||||
H UNIX system dependent parts
|
H UNIX system dependent parts
|
||||||
S io.c
|
|
||||||
S log.c
|
S log.c
|
||||||
S krt.c
|
S krt.c
|
||||||
|
# io.c is documented under Resources
|
||||||
|
@ -5,6 +5,7 @@ io.c
|
|||||||
unix.h
|
unix.h
|
||||||
endian.h
|
endian.h
|
||||||
config.Y
|
config.Y
|
||||||
|
random.c
|
||||||
|
|
||||||
krt.c
|
krt.c
|
||||||
krt.h
|
krt.h
|
||||||
|
@ -28,20 +28,6 @@
|
|||||||
#include "lib/unix.h"
|
#include "lib/unix.h"
|
||||||
#include "lib/sysio.h"
|
#include "lib/sysio.h"
|
||||||
|
|
||||||
/*
|
|
||||||
* Random Numbers
|
|
||||||
*/
|
|
||||||
|
|
||||||
u32
|
|
||||||
random_u32(void)
|
|
||||||
{
|
|
||||||
long int rand_low, rand_high;
|
|
||||||
|
|
||||||
rand_low = random();
|
|
||||||
rand_high = random();
|
|
||||||
return (rand_low & 0xffff) | ((rand_high & 0xffff) << 16);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Tracked Files
|
* Tracked Files
|
||||||
*/
|
*/
|
||||||
|
21
sysdep/unix/random.c
Normal file
21
sysdep/unix/random.c
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
/*
|
||||||
|
* BIRD Internet Routing Daemon -- Random Numbers
|
||||||
|
*
|
||||||
|
* (c) 2000 Martin Mares <mj@ucw.cz>
|
||||||
|
*
|
||||||
|
* Can be freely distributed and used under the terms of the GNU GPL.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
#include "nest/bird.h"
|
||||||
|
|
||||||
|
u32
|
||||||
|
random_u32(void)
|
||||||
|
{
|
||||||
|
long int rand_low, rand_high;
|
||||||
|
|
||||||
|
rand_low = random();
|
||||||
|
rand_high = random();
|
||||||
|
return (rand_low & 0xffff) | ((rand_high & 0xffff) << 16);
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user