From: asterix Date: Wed, 11 Jun 2008 17:31:05 +0000 (+0000) Subject: Move rand alogo in correct dir. X-Git-Tag: 2.0.0~482 X-Git-Url: https://codewiz.org/gitweb?a=commitdiff_plain;h=16af9888ee7ec67f627e73d65997d2d4cf23a615;p=bertos.git Move rand alogo in correct dir. git-svn-id: https://src.develer.com/svnoss/bertos/trunk@1452 38d2e660-2303-0410-9eaa-f027e97ec537 --- diff --git a/bertos/algo/rand.c b/bertos/algo/rand.c new file mode 100644 index 00000000..5e7f1f41 --- /dev/null +++ b/bertos/algo/rand.c @@ -0,0 +1,49 @@ +/** + * \file + * + * + * \brief Very simple rand() algorithm. + * + * \version $Id$ + * \author Bernardo Innocenti + */ + +/* This would really belong to libc */ +int rand(void) +{ + static unsigned long seed; + + /* Randomize seed */ + seed = (seed ^ 0x4BAD5A39UL) + 6513973UL; + + return (int)(seed>>16); +} diff --git a/bertos/algo/rand.h b/bertos/algo/rand.h new file mode 100644 index 00000000..a0bec4ff --- /dev/null +++ b/bertos/algo/rand.h @@ -0,0 +1,41 @@ +/** + * \file + * + * + * \brief Very simple rand() algorithm. + * + * \version $Id$ + * \author Bernardo Innocenti + */ + +int rand(void); + diff --git a/bertos/mware/rand.c b/bertos/mware/rand.c deleted file mode 100644 index 5e7f1f41..00000000 --- a/bertos/mware/rand.c +++ /dev/null @@ -1,49 +0,0 @@ -/** - * \file - * - * - * \brief Very simple rand() algorithm. - * - * \version $Id$ - * \author Bernardo Innocenti - */ - -/* This would really belong to libc */ -int rand(void) -{ - static unsigned long seed; - - /* Randomize seed */ - seed = (seed ^ 0x4BAD5A39UL) + 6513973UL; - - return (int)(seed>>16); -}