CLHEP 2.4.6.4
C++ Class Library for High Energy Physics
Loading...
Searching...
No Matches
RandomFunc.h
Go to the documentation of this file.
1// -*- C++ -*-
2// $Id: RandomFunc.h,v 1.6 2010/06/16 17:24:53 garren Exp $
3// -----------------------------------------------------------------------
4// HEP RandomFunc
5// get proper system headers for drand, etc.
6// -----------------------------------------------------------------------
7
8#ifndef RANDOMFUNC_H
9#define RANDOMFUNC_H
10
11// Those function are available on all unix platform but their
12// prototypes are not included in stdlib when strict ANSI flag is set.
13// Such behaviour was noticed with "KCC --strict" and "g++ -ansi".
14//
15// To provide declaration of those functions on Linux g++ should be used
16// with -D_GNU_SOURCE. Similar options for non-Linux plaforms are:
17// _HPUX_SOURCE, _IRIX_SOURCE, but we prefer just explicitely declare
18// the functions on those platforms.
19//
20// drand48() extracted from GNU C Library 2.1.3 is used on Windows NT
21// and Macintosh (see drand48.src)
22
23#if !defined(__GNUC__)
24extern "C" {
25 extern double drand48(void);
26 extern void srand48(long);
27 extern unsigned short * seed48(unsigned short int [3]);
28}
29#else
30// only use stdlib.h if -D_GNU_SOURCE is present
31#if defined(_GNU_SOURCE)
32#include <stdlib.h>
33#else
34extern "C" {
35 extern double drand48(void);
36 extern void srand48(long);
37 extern unsigned short * seed48(unsigned short int [3]);
38}
39#endif
40#endif
41
42#include "CLHEP/Random/defs.h"
43
44namespace CLHEP {
45
46//#ifdef WIN32
47//#include "drand48.src"
48//#endif /* WIN32 */
49
50//#ifdef __APPLE__
51//#include "drand48.src"
52//#endif /* __APPLE__ */
53
54// configure checks for drand48
55#ifndef HAVE_DRAND48
56#if !defined(__GNUC__) // IRIX gets confused
57#include "drand48.src"
58#endif
59#endif
60
61} // namespace CLHEP
62
63#ifdef ENABLE_BACKWARDS_COMPATIBILITY
64// backwards compatibility will be enabled ONLY in CLHEP 1.9
65using namespace CLHEP;
66#endif
67
68#endif // RANDOMFUNC_H
void srand48(long)
unsigned short * seed48(unsigned short int[3])
double drand48(void)