genode/repos/demo/include/scout_gfx/random.h
Norman Feske ca971bbfd8 Move repositories to 'repos/' subdirectory
This patch changes the top-level directory layout as a preparatory
step for improving the tools for managing 3rd-party source codes.
The rationale is described in the issue referenced below.

Issue #1082
2014-05-14 16:08:00 +02: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_ */