mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-14 08:57:58 +00:00
467382ca03
After some header file cleanups to add missing include files, remove common.h from all files in the lib directory. This primarily means just dropping the line but in a few cases we need to add in other header files now. Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Tom Rini <trini@konsulko.com>
31 lines
477 B
C
31 lines
477 B
C
// SPDX-License-Identifier: GPL-2.0+
|
|
/*
|
|
* Simple xorshift PRNG
|
|
* see http://www.jstatsoft.org/v08/i14/paper
|
|
*
|
|
* Copyright (c) 2012 Michael Walle
|
|
* Michael Walle <michael@walle.cc>
|
|
*/
|
|
|
|
#include <rand.h>
|
|
|
|
static unsigned int y = 1U;
|
|
|
|
unsigned int rand_r(unsigned int *seedp)
|
|
{
|
|
*seedp ^= (*seedp << 13);
|
|
*seedp ^= (*seedp >> 17);
|
|
*seedp ^= (*seedp << 5);
|
|
|
|
return *seedp;
|
|
}
|
|
|
|
unsigned int rand(void)
|
|
{
|
|
return rand_r(&y);
|
|
}
|
|
|
|
void srand(unsigned int seed)
|
|
{
|
|
y = seed;
|
|
}
|