File: wnrflt.c

package info (click to toggle)
libwn6 6.0-3
  • links: PTS
  • area: main
  • in suites: potato
  • size: 5,996 kB
  • ctags: 3,938
  • sloc: ansic: 45,083; makefile: 926; csh: 274; sh: 12
file content (39 lines) | stat: -rw-r--r-- 668 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
/****************************************************************************

COPYRIGHT NOTICE:

  The source code in this file is provided free of charge
  to the author's consulting clients.  It is in the
  public domain and therefore may be used by anybody for
  any purpose.

AUTHOR:

  Will Naylor

****************************************************************************/

#include "wnlib.h"

#include "wnrnd.h"
#include "wnrndd.h"



#define RANGE_BITS  30
#define RANGE       (1<<RANGE_BITS)


double wn_flat_distribution(void)
{
  double ret;

  ret = (double)wn_random_n_bits(RANGE_BITS);

  ret += 0.5;

  ret = ret/((double)RANGE);

  return(ret);
}