samsung: tizen_amlogic: increase ramdisk size from 8M to 32M
[platform/kernel/u-boot.git] / lib / rand.c
1 // SPDX-License-Identifier: GPL-2.0+
2 /*
3  * Simple xorshift PRNG
4  *   see http://www.jstatsoft.org/v08/i14/paper
5  *
6  * Copyright (c) 2012 Michael Walle
7  * Michael Walle <michael@walle.cc>
8  */
9
10 #include <common.h>
11 #include <rand.h>
12
13 #ifndef CONFIG_LIB_HW_RAND
14 static unsigned int y = 1U;
15
16 unsigned int rand_r(unsigned int *seedp)
17 {
18         *seedp ^= (*seedp << 13);
19         *seedp ^= (*seedp >> 17);
20         *seedp ^= (*seedp << 5);
21
22         return *seedp;
23 }
24
25 unsigned int rand(void)
26 {
27         return rand_r(&y);
28 }
29
30 void srand(unsigned int seed)
31 {
32         y = seed;
33 }
34 #endif