1 /* 2 * (c) 2008-2009 Frank Mehnert <fm3@os.inf.tu-dresden.de>, 3 * Michael Hohmuth <hohmuth@os.inf.tu-dresden.de>, 4 * Lars Reuther <reuther@os.inf.tu-dresden.de> 5 * economic rights: Technische Universität Dresden (Germany) 6 * This file is part of TUD:OS and distributed under the terms of the 7 * GNU Lesser General Public License 2.1. 8 * Please see the COPYING-LGPL-2.1 file for details. 9 */ 10 /* 11 */ 12 13 /***************************************************************************** 14 * random.c * 15 * pseudo-random number generator * 16 *****************************************************************************/ 17 18 #include <l4/util/rand.h> 19 20 static unsigned int l4_rand_next = 1; 21 22 L4_CV l4_uint32_t l4util_rand(void)23l4util_rand(void) 24 { 25 l4_rand_next = l4_rand_next * 1103515245 + 12345; 26 return ((l4_rand_next >>16) & L4_RAND_MAX); 27 } 28 29 L4_CV void l4util_srand(l4_uint32_t seed)30l4util_srand (l4_uint32_t seed) 31 { 32 l4_rand_next = seed; 33 } 34 35