summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorMichael Walle <michael@walle.cc>2012-06-05 11:33:14 +0000
committerAlbert ARIBAUD <albert.u.boot@aribaud.net>2012-07-07 14:07:32 +0200
commit9acf1ca50d8b031511d146f6ffd73201fedce28c (patch)
treea10e3bb54c3a410ea568ce0d69ff9ef42a601145 /include
parentd131ad68c6566749df10154d2a6fa93df5865495 (diff)
lib: add rand() function
It's a PRNG using the simple and fast xorshift method. Signed-off-by: Michael Walle <michael@walle.cc> Cc: Wolfgang Denk <wd@denx.de>
Diffstat (limited to 'include')
-rw-r--r--include/common.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/include/common.h b/include/common.h
index 7cf15c53b74..e16c53e538e 100644
--- a/include/common.h
+++ b/include/common.h
@@ -760,6 +760,14 @@ char * strmhz(char *buf, unsigned long hz);
/* lib/crc32.c */
#include <u-boot/crc.h>
+/* lib/rand.c */
+#ifdef CONFIG_RANDOM_MACADDR
+#define RAND_MAX -1U
+void srand(unsigned int seed);
+unsigned int rand(void);
+unsigned int rand_r(unsigned int *seedp);
+#endif
+
/* common/console.c */
int console_init_f(void); /* Before relocation; uses the serial stuff */
int console_init_r(void); /* After relocation; uses the console stuff */