Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Spot
Spot
Commits
4a7486bb
Commit
4a7486bb
authored
Nov 12, 2004
by
Alexandre Duret-Lutz
Browse files
* configure.ac: Check for srand48 and drand48.
* src/misc/random.cc (srand, drand): Use srand48 and drand48 if available.
parent
5bcb6091
Changes
3
Hide whitespace changes
Inline
Side-by-side
ChangeLog
View file @
4a7486bb
2004-11-12 Alexandre Duret-Lutz <adl@src.lip6.fr>
* configure.ac: Check for srand48 and drand48.
* src/misc/random.cc (srand, drand): Use srand48 and drand48 if
available.
* src/tgbaalgos/randomgraph.cc, src/tgbaalgos/randomgraph.hh: New files.
* src/tgbaalgos/Makefile.am (tgbaalgos_HEADERS)
(libtgbaalgos_la_SOURCES): Add them.
...
...
configure.ac
View file @
4a7486bb
...
...
@@ -45,6 +45,8 @@ AX_CHECK_BUDDY
AX_CHECK_LBTT
AX_CHECK_GSPNLIB
AC_CHECK_FUNCS([srand48 drand48])
AC_LIBTOOL_WIN32_DLL
AC_PROG_LIBTOOL
...
...
src/misc/random.cc
View file @
4a7486bb
...
...
@@ -27,24 +27,30 @@ namespace spot
void
srand
(
unsigned
int
seed
)
{
#if HAVE_SRAND48 && HAVE_DRAND48
::
srand48
(
seed
);
#else
::
srand
(
seed
);
#endif
}
double
drand
()
{
#if HAVE_SRAND48 && HAVE_DRAND48
return
::
drand48
();
#else
double
r
=
::
rand
();
return
r
/
(
1.0
+
RAND_MAX
);
#endif
}
int
mrand
(
int
max
)
{
int
res
=
static_cast
<
int
>
(
max
*
drand
());
return
res
;
return
static_cast
<
int
>
(
max
*
drand
());
}
int
rrand
(
int
min
,
int
max
)
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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