source: src/tests/random.c@ d9b499c

ADT aaron-thesis arm-eh ast-experimental cleanup-dtors ctor deferred_resn demangler enum forall-pointer-decay jacob/cs343-translation jenkins-sandbox memory new-ast new-ast-unique-expr new-env no_list persistent-indexer pthread-emulation qualifiedEnum resolv-new with_gc
Last change on this file since d9b499c was ed0e67a, checked in by Peter A. Buhr <pabuhr@…>, 9 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
20int 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.