ccmath  2.2.1
About: A mathematics library coded in the C-language containing functions for linear algebra, numerical integration, geometry and trigonometry, curve fitting, roots and optimization, Fourier analysis, simulation generation, statistics, special functions, sorts and searches, time series models, complex arithmetic, and high precision math.
  Fossies Dox: ccmath-2.2.1.tar.gz  ("inofficial" and yet experimental doxygen-generated source code documentation)  

lrana.c
Go to the documentation of this file.
1 /* lrana.c CCMATH mathematics library source code.
2  *
3  * Copyright (C) 2000 Daniel A. Atkinson All rights reserved.
4  * This code may be redistributed under the terms of the GNU library
5  * public license (LGPL). ( See the lgpl.license file for details.)
6  * ------------------------------------------------------------------------
7  */
8 /*
9  C version of the routine for a multiplicative
10  generator modulo 2^31-1.
11 */
12 
13 static unsigned int m=16807U,k=0xffffU,j=0xfffeU;
14 static unsigned int u=0x80000000U,v=0x7fffffffU;
15 unsigned int lrana(unsigned int s)
16 { register unsigned int z,f;
17  z=m*(s&k); f=(s>>16)*m; f+=(z>>16);
18  z=(z&k)+(f<<16); f=(f>>15)&j;
19  if(z&u) f|=1L;
20  s=f+(z&v);
21  if(s&u) s=(s+1)&v;
22  return s;
23 }
k
static unsigned int k
Definition: lrana.c:13
s
static unsigned int s
Definition: bran.c:8
j
static unsigned int j
Definition: lrana.c:13
v
static unsigned int v
Definition: lrana.c:14
f
static double f
Definition: rcbes.c:9
lrana
unsigned int lrana(unsigned int s)
Definition: lrana.c:15
u
static unsigned int u
Definition: lrana.c:14
m
static unsigned int m
Definition: lrana.c:13