ADT
        aaron-thesis
        arm-eh
        ast-experimental
        cleanup-dtors
        deferred_resn
        demangler
        enum
        forall-pointer-decay
        jacob/cs343-translation
        jenkins-sandbox
        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 6aa537a4 was             6c7b1e7, checked in by Peter A. Buhr <pabuhr@…>, 8 years ago           | 
        
        
          | 
             
change random name 
 
           | 
        
        
          
            
              - 
Property                 mode
 set to                 
100644
               
             
           | 
        
        
          | 
            File size:
            1.3 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 : Mon Oct 30 23:06:49 2017
 | 
|---|
| 13 | // Update Count     : 6
 | 
|---|
| 14 | // 
 | 
|---|
| 15 | 
 | 
|---|
| 16 | #include <fstream>
 | 
|---|
| 17 | #include <stdlib>                                                                               // random
 | 
|---|
| 18 | #include <unistd.h>                                                                             // getpid
 | 
|---|
| 19 | 
 | 
|---|
| 20 | int main() {
 | 
|---|
| 21 |         //srandom( getpid() );                                                          // set random seed
 | 
|---|
| 22 |         random_seed( 1003 );                                                            // fixed seed for repeatable tests
 | 
|---|
| 23 | 
 | 
|---|
| 24 |         // test polymorphic calls to random and stream
 | 
|---|
| 25 |         char c = random();
 | 
|---|
| 26 |         sout | c | endl;
 | 
|---|
| 27 |         int i = random();
 | 
|---|
| 28 |     sout | i | endl;
 | 
|---|
| 29 |         unsigned int ui = random();
 | 
|---|
| 30 |     sout | ui | endl;
 | 
|---|
| 31 |         long int li = random();
 | 
|---|
| 32 |     sout | li | endl;
 | 
|---|
| 33 |         unsigned long int uli = random();
 | 
|---|
| 34 |     sout | uli | endl;
 | 
|---|
| 35 |     float f = random();
 | 
|---|
| 36 |     sout | f | endl;
 | 
|---|
| 37 |     double d = random();
 | 
|---|
| 38 |     sout | d | endl;
 | 
|---|
| 39 |     float _Complex fc = random();
 | 
|---|
| 40 |     sout | fc | endl;
 | 
|---|
| 41 |     double _Complex dc = random();
 | 
|---|
| 42 |     sout | dc | endl;
 | 
|---|
| 43 |     long double _Complex ldc = random();
 | 
|---|
| 44 |     sout | ldc | endl;
 | 
|---|
| 45 | } // main
 | 
|---|
| 46 | 
 | 
|---|
| 47 | // Local Variables: //
 | 
|---|
| 48 | // tab-width: 4 //
 | 
|---|
| 49 | // compile-command: "cfa random.c" //
 | 
|---|
| 50 | // End: //
 | 
|---|
       
      
  Note:
 See   
TracBrowser
 for help on using the repository browser.