+2006-09-26 Maarten Brock <sourceforge.brock AT dse.nl>
+
+ * device/include/stdlib.h: added rand prototypes
+ * device/lib/rand.c: new, added
+
2006-09-20 Raphael Neider <rneider AT web.de>
* device/lib/pic16/libio/i2c/i2cnack.c (i2c_nack): fixed ACKDT bit
--- /dev/null
+/*-------------------------------------------------------------------------\r
+ rand.c - random number generator\r
+\r
+ Written By - Maarten Brock, sourceforge.brock@dse.nl (2006)\r
+\r
+ This library is free software; you can redistribute it and/or\r
+ modify it under the terms of the GNU Lesser General Public\r
+ License as published by the Free Software Foundation; either\r
+ version 2.1 of the License, or (at your option) any later version.\r
+\r
+ This library is distributed in the hope that it will be useful,\r
+ but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\r
+ Lesser General Public License for more details.\r
+\r
+ You should have received a copy of the GNU Lesser General Public\r
+ License along with this library; if not, write to the Free Software\r
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\r
+\r
+ In other words, you are welcome to use, share and improve this program.\r
+ You are forbidden to forbid anyone else to use, share and improve\r
+ what you give them. Help stamp out software-hoarding!\r
+-------------------------------------------------------------------------*/\r
+\r
+#include <stdlib.h>\r
+\r
+static unsigned long int next = 1;\r
+\r
+int rand(void)\r
+{\r
+ next = next * 1103515245UL + 12345;\r
+ return (unsigned int)(next/65536) % (RAND_MAX + 1);\r
+}\r
+\r
+void srand(unsigned int seed)\r
+{\r
+ next = seed;\r
+}\r