Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OpenXG-RAN
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
spbro
OpenXG-RAN
Commits
8cacbb88
Commit
8cacbb88
authored
Dec 19, 2022
by
Robert Schmidt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Address review comments
parent
e99c019f
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
18 additions
and
17 deletions
+18
-17
openair1/SIMULATION/TOOLS/rangen_double.c
openair1/SIMULATION/TOOLS/rangen_double.c
+11
-12
openair1/SIMULATION/TOOLS/sim.h
openair1/SIMULATION/TOOLS/sim.h
+1
-1
openair1/SIMULATION/TOOLS/taus.c
openair1/SIMULATION/TOOLS/taus.c
+3
-3
openair3/ocp-gtpu/gtp_itf.cpp
openair3/ocp-gtpu/gtp_itf.cpp
+3
-1
No files found.
openair1/SIMULATION/TOOLS/rangen_double.c
View file @
8cacbb88
...
@@ -29,33 +29,32 @@
...
@@ -29,33 +29,32 @@
static
unsigned
int
urseed
,
iy
,
ir
[
98
];
/// uniformrandom
static
unsigned
int
urseed
,
iy
,
ir
[
98
];
/// uniformrandom
static
bool
tableNordDone
=
false
;
/// gaussZiggurat
static
bool
tableNordDone
=
false
;
/// gaussZiggurat
#define a 1664525lu
#define mod 4294967296.0
/* is 2**32 */
/*!\brief Generate a random number form `/dev/urandom`. */
/*!\brief Generate a random number form `/dev/urandom`. */
unsigned
long
get_random_seed
(
void
)
void
fill_random
(
void
*
buf
,
size_t
sz
)
{
{
unsigned
long
seed
;
const
char
*
fn
=
"/dev/urandom"
;
const
char
*
fn
=
"/dev/urandom"
;
FILE
*
f
=
fopen
(
fn
,
"rb"
);
FILE
*
f
=
fopen
(
fn
,
"rb"
);
if
(
f
==
NULL
)
{
if
(
f
==
NULL
)
{
fprintf
(
stderr
,
"could not open %s for seed generation: %d %s
\n
"
,
fn
,
errno
,
strerror
(
errno
));
fprintf
(
stderr
,
"could not open %s for seed generation: %d %s
\n
"
,
fn
,
errno
,
strerror
(
errno
));
abort
();
abort
();
}
}
int
rc
=
fread
(
&
seed
,
sizeof
(
seed
)
,
1
,
f
);
int
rc
=
fread
(
buf
,
sz
,
1
,
f
);
if
(
rc
<
0
)
{
if
(
rc
<
0
)
{
fprintf
(
stderr
,
"could not read %s for seed generation: %d %s
\n
"
,
fn
,
errno
,
strerror
(
errno
));
fprintf
(
stderr
,
"could not read %s for seed generation: %d %s
\n
"
,
fn
,
errno
,
strerror
(
errno
));
abort
();
abort
();
}
}
fclose
(
f
);
fclose
(
f
);
return
seed
;
}
}
static
const
unsigned
int
a
=
1664525lu
;
/*!\brief Initialization routine for Uniform/Gaussian random number generators. */
/*!\brief Initialization routine for Uniform/Gaussian random number generators. */
void
randominit
(
unsigned
long
seed_init
)
void
randominit
(
unsigned
long
seed_init
)
{
{
unsigned
long
seed
=
seed_init
!=
0
?
seed_init
:
get_random_seed
();
unsigned
long
seed
=
seed_init
;
if
(
seed_init
==
0
)
fill_random
(
&
seed
,
sizeof
(
seed
));
printf
(
"Initializing random number generator, seed %ld
\n
"
,
seed
);
printf
(
"Initializing random number generator, seed %ld
\n
"
,
seed
);
// initialize uniformrandom RNG
// initialize uniformrandom RNG
...
@@ -82,9 +81,7 @@ void randominit(unsigned long seed_init)
...
@@ -82,9 +81,7 @@ void randominit(unsigned long seed_init)
double
uniformrandom
(
void
)
double
uniformrandom
(
void
)
{
{
#define a 1664525lu
const
double
mod
=
4294967296
.
0
;
/* is 2**32 */
#define mod 4294967296.0
/* is 2**32 */
int
j
=
1
+
97
.
0
*
iy
/
mod
;
int
j
=
1
+
97
.
0
*
iy
/
mod
;
iy
=
ir
[
j
];
iy
=
ir
[
j
];
urseed
=
a
*
urseed
;
/* mod 2**32 */
urseed
=
a
*
urseed
;
/* mod 2**32 */
...
@@ -197,7 +194,9 @@ double __attribute__ ((no_sanitize_address)) gaussZiggurat(double mean, double v
...
@@ -197,7 +194,9 @@ double __attribute__ ((no_sanitize_address)) gaussZiggurat(double mean, double v
{
{
if
(
!
tableNordDone
)
{
if
(
!
tableNordDone
)
{
// let's make reasonnable constant tables
// let's make reasonnable constant tables
tableNor
(
get_random_seed
());
unsigned
long
seed
;
fill_random
(
&
seed
,
sizeof
(
seed
));
tableNor
(
seed
);
}
}
hz
=
SHR3
;
hz
=
SHR3
;
iz
=
hz
&
127
;
iz
=
hz
&
127
;
...
...
openair1/SIMULATION/TOOLS/sim.h
View file @
8cacbb88
...
@@ -523,7 +523,7 @@ the value \f$\mathrm{sgn}(u)i\f$. The search requires at most \f$Nbits-1\f$ com
...
@@ -523,7 +523,7 @@ the value \f$\mathrm{sgn}(u)i\f$. The search requires at most \f$Nbits-1\f$ com
*/
*/
int
gauss
(
unsigned
int
*
gauss_LUT
,
unsigned
char
Nbits
);
int
gauss
(
unsigned
int
*
gauss_LUT
,
unsigned
char
Nbits
);
unsigned
long
get_random_seed
(
void
);
void
fill_random
(
void
*
buf
,
size_t
sz
);
double
gaussdouble
(
double
,
double
);
double
gaussdouble
(
double
,
double
);
void
randominit
(
unsigned
long
seed_init
);
void
randominit
(
unsigned
long
seed_init
);
double
uniformrandom
(
void
);
double
uniformrandom
(
void
);
...
...
openair1/SIMULATION/TOOLS/taus.c
View file @
8cacbb88
...
@@ -52,9 +52,9 @@ void set_taus_seed(unsigned int seed_init)
...
@@ -52,9 +52,9 @@ void set_taus_seed(unsigned int seed_init)
unsigned
long
result
=
0
;
unsigned
long
result
=
0
;
if
(
seed_init
==
0
)
{
if
(
seed_init
==
0
)
{
s0
=
(
unsigned
int
)
get_random_seed
(
);
fill_random
(
&
s0
,
sizeof
(
s0
)
);
s1
=
(
unsigned
int
)
get_random_seed
(
);
fill_random
(
&
s1
,
sizeof
(
s1
)
);
s2
=
(
unsigned
int
)
get_random_seed
(
);
fill_random
(
&
s2
,
sizeof
(
s2
)
);
}
else
{
}
else
{
/* Use reentrant version of rand48 to ensure that no conflicts with other generators occur */
/* Use reentrant version of rand48 to ensure that no conflicts with other generators occur */
srand48_r
((
long
int
)
seed_init
,
&
buffer
);
srand48_r
((
long
int
)
seed_init
,
&
buffer
);
...
...
openair3/ocp-gtpu/gtp_itf.cpp
View file @
8cacbb88
...
@@ -144,7 +144,9 @@ class gtpEndPoints {
...
@@ -144,7 +144,9 @@ class gtpEndPoints {
map
<
uint64_t
,
gtpEndPoint
>
instances
;
map
<
uint64_t
,
gtpEndPoint
>
instances
;
gtpEndPoints
()
{
gtpEndPoints
()
{
srandom
(
get_random_seed
());
unsigned
int
seed
;
fill_random
(
&
seed
,
sizeof
(
seed
));
srandom
(
seed
);
}
}
~
gtpEndPoints
()
{
~
gtpEndPoints
()
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment