Commit | Line | Data |
---|---|---|
88cbdf0b C |
1 | /* |
2 | Copyright (C) 1988 Free Software Foundation | |
3 | written by Dirk Grunwald (grunwald@cs.uiuc.edu) | |
4 | ||
5 | This file is part of GNU CC. | |
6 | ||
7 | GNU CC is distributed in the hope that it will be useful, | |
8 | but WITHOUT ANY WARRANTY. No author or distributor | |
9 | accepts responsibility to anyone for the consequences of using it | |
10 | or for whether it serves any particular purpose or works at all, | |
11 | unless he says so in writing. Refer to the GNU CC General Public | |
12 | License for full details. | |
13 | ||
14 | Everyone is granted permission to copy, modify and redistribute | |
15 | GNU CC, but only under the conditions described in the | |
16 | GNU CC General Public License. A copy of this license is | |
17 | supposed to have been given to you along with GNU CC so you | |
18 | can know your rights and responsibilities. It should be in a | |
19 | file named COPYING. Among other things, the copyright notice | |
20 | and this notice must be preserved on all copies. | |
21 | */ | |
22 | #ifdef __GNUG__ | |
23 | #pragma implementation | |
24 | #endif | |
25 | #include <builtin.h> | |
26 | #include <Random.h> | |
27 | ||
28 | #include <Erlang.h> | |
29 | ||
30 | double Erlang::operator()() | |
31 | { | |
32 | double prod = 1.0; | |
33 | ||
34 | for (int i = 0; i < k; i++) { | |
35 | prod *= pGenerator -> asDouble(); | |
36 | } | |
37 | return(-log(prod)/a); | |
38 | } |