mirror of
https://github.com/genodelabs/genode.git
synced 2024-12-30 18:47:01 +00:00
32 lines
662 B
C
32 lines
662 B
C
|
/*
|
||
|
* \brief Pseudo random-number generator
|
||
|
* \date 2005-10-24
|
||
|
* \author Norman Feske
|
||
|
*/
|
||
|
|
||
|
/*
|
||
|
* Copyright (C) 2005-2013 Genode Labs GmbH
|
||
|
*
|
||
|
* This file is part of the Genode OS framework, which is distributed
|
||
|
* under the terms of the GNU General Public License version 2.
|
||
|
*/
|
||
|
|
||
|
#ifndef _INCLUDE__SCOUT_GFX__RANDOM_H_
|
||
|
#define _INCLUDE__SCOUT_GFX__RANDOM_H_
|
||
|
|
||
|
namespace Scout {
|
||
|
|
||
|
/**
|
||
|
* Produce pseudo random values
|
||
|
*/
|
||
|
static inline int random()
|
||
|
{
|
||
|
static unsigned int seed = 93186752;
|
||
|
const unsigned int a = 1588635695, q = 2, r = 1117695901;
|
||
|
seed = a*(seed % q) - r*(seed / q);
|
||
|
return seed;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
#endif /* _INCLUDE__SCOUT_GFX__RANDOM_H_ */
|