ADTaaron-thesisarm-ehast-experimentalcleanup-dtorsctordeferred_resndemanglerenumforall-pointer-decayjacob/cs343-translationjenkins-sandboxmemorynew-astnew-ast-unique-exprnew-envno_listpersistent-indexerpthread-emulationqualifiedEnumresolv-newwith_gc
Last change
on this file since e04c5ff was
ed0e67a,
checked in by Peter A. Buhr <pabuhr@…>, 8 years ago
|
add stdhdr directory to includes, containing extern "C" include wrappers for standard C include files
|
-
Property mode set to
100644
|
File size:
1.2 KB
|
Line | |
---|
1 | // |
---|
2 | // Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo |
---|
3 | // |
---|
4 | // The contents of this file are covered under the licence agreement in the |
---|
5 | // file "LICENCE" distributed with Cforall. |
---|
6 | // |
---|
7 | // random.c -- |
---|
8 | // |
---|
9 | // Author : Peter A. Buhr |
---|
10 | // Created On : Tue Jul 5 21:29:30 2016 |
---|
11 | // Last Modified By : Peter A. Buhr |
---|
12 | // Last Modified On : Tue Jul 5 21:29:54 2016 |
---|
13 | // Update Count : 1 |
---|
14 | // |
---|
15 | |
---|
16 | #include <fstream> |
---|
17 | #include <stdlib> // random |
---|
18 | #include <unistd.h> // getpid |
---|
19 | |
---|
20 | int main() { |
---|
21 | rand48seed( getpid() ); // set random seed |
---|
22 | |
---|
23 | // test polymorphic calls to random and stream |
---|
24 | char c = rand48(); |
---|
25 | sout | c | endl; |
---|
26 | int i = rand48(); |
---|
27 | sout | i | endl; |
---|
28 | unsigned int ui = rand48(); |
---|
29 | sout | ui | endl; |
---|
30 | long int li = rand48(); |
---|
31 | sout | li | endl; |
---|
32 | unsigned long int uli = rand48(); |
---|
33 | sout | uli | endl; |
---|
34 | float f = rand48(); |
---|
35 | sout | f | endl; |
---|
36 | double d = rand48(); |
---|
37 | sout | d | endl; |
---|
38 | float _Complex fc = rand48(); |
---|
39 | sout | fc | endl; |
---|
40 | double _Complex dc = rand48(); |
---|
41 | sout | dc | endl; |
---|
42 | long double _Complex ldc = rand48(); |
---|
43 | sout | ldc | endl; |
---|
44 | } // main |
---|
45 | |
---|
46 | // Local Variables: // |
---|
47 | // tab-width: 4 // |
---|
48 | // compile-command: "cfa random.c" // |
---|
49 | // End: // |
---|
Note: See
TracBrowser
for help on using the repository browser.