genode/demo/include/scout_gfx/random.h
Norman Feske 3394be9464 Clean up scout widgets
This patch integrate the scout widgets with Genode's new API headers
'util/geometry.h', 'os/surface.h' and 'os/texture.h'. Thereby, we get
almost rid of the platform-abstraction shim that was never used anyway.

Furthermore, it extracts the parts that are worth reusing from the
scout implementation to the public location 'demo/include/scout'.
2014-01-27 18:54:06 +01:00

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_ */