mini-os: move poor rand function to test.c

It's only used by test.c and probably isn't something that should be
exposed for general use (it just calls gettimeofday).

This is also useful for ARM, which doesn't use math.c, where this used
to live.

Signed-off-by: Thomas Leonard <talex5@gmail.com>
Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
This commit is contained in:
Thomas Leonard authored and Ian Campbell committed 2014-09-08 12:15:36 +01:00
1 parent 2903df8430
commit 7b4afdbe81
2 files changed
+13 -13

No files matched your search

-13
View File
@@ -424,16 +424,3 @@ __moddi3(quad_t a, quad_t b)
(void)__qdivrem(ua, ub, &ur);
return (neg ? -ur : ur);
}
#ifndef HAVE_LIBC
/* Should be random enough for our uses */
int rand(void)
{
static unsigned int previous;
struct timeval tv;
gettimeofday(&tv, NULL);
previous += tv.tv_sec + tv.tv_usec;
previous *= RAND_MIX;
return previous;
}
#endif
+13
View File
@@ -60,6 +60,19 @@ static void xenbus_tester(void *p)
}
#endif
#ifndef HAVE_LIBC
/* Should be random enough for our uses */
int rand(void)
{
static unsigned int previous;
struct timeval tv;
gettimeofday(&tv, NULL);
previous += tv.tv_sec + tv.tv_usec;
previous *= RAND_MIX;
return previous;
}
#endif
static void periodic_thread(void *p)
{
struct timeval tv;
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.