Changeset 90152a4 for tests/random.c


Ignore:
Timestamp:
Aug 27, 2018, 4:40:34 PM (7 years ago)
Author:
Rob Schluntz <rschlunt@…>
Branches:
ADT, arm-eh, ast-experimental, cleanup-dtors, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
b7c89aa
Parents:
f9feab8 (diff), 305581d (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' into cleanup-dtors

File:
1 moved

Legend:

Unmodified
Added
Removed
  • tests/random.c

    rf9feab8 r90152a4  
    1 // 
     1//
    22// Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo
    33//
    44// The contents of this file are covered under the licence agreement in the
    55// file "LICENCE" distributed with Cforall.
    6 // 
    7 // random.c -- 
    8 // 
     6//
     7// random.c --
     8//
    99// Author           : Peter A. Buhr
    1010// Created On       : Tue Jul  5 21:29:30 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Mon Oct 30 23:06:49 2017
    13 // Update Count     : 6
    14 // 
     12// Last Modified On : Tue Jan  2 12:19:34 2018
     13// Update Count     : 19
     14//
    1515
    16 #include <fstream>
    17 #include <stdlib>                                                                               // random
     16#include <fstream.hfa>
     17#include <stdlib.hfa>                                                                           // random
    1818#include <unistd.h>                                                                             // getpid
    1919
    2020int main() {
    21         //srandom( getpid() );                                                          // set random seed
    22         random_seed( 1003 );                                                            // fixed seed for repeatable tests
     21        // srandom( getpid() );                                                         // set random seed
     22        srandom( 1003 );                                                                        // fixed seed for repeatable tests
    2323
    2424        // test polymorphic calls to random and stream
    2525        char c = random();
    2626        sout | c | endl;
     27        c = random( 'A' );
     28        sout | c | endl;
     29        c = random( 'A', 'Z' );
     30        sout | c | endl;
     31
    2732        int i = random();
    2833    sout | i | endl;
     34        i = random( 10 );
     35    sout | i | endl;
     36        i = random( -10, 20 );
     37    sout | i | endl;
     38
    2939        unsigned int ui = random();
    3040    sout | ui | endl;
     41        ui = random( 10u );
     42    sout | ui | endl;
     43        ui = random( 10u, 20u );
     44    sout | ui | endl;
     45
    3146        long int li = random();
    3247    sout | li | endl;
     48        li = random( 10l );
     49    sout | li | endl;
     50        li = random( -10l, 20l );
     51    sout | li | endl;
     52
    3353        unsigned long int uli = random();
    3454    sout | uli | endl;
     55        uli = random( 10ul );
     56    sout | uli | endl;
     57        uli = random( 10ul, 20ul );
     58    sout | uli | endl;
     59
    3560    float f = random();
    3661    sout | f | endl;
     62
    3763    double d = random();
    3864    sout | d | endl;
     65
    3966    float _Complex fc = random();
    4067    sout | fc | endl;
     68
    4169    double _Complex dc = random();
    4270    sout | dc | endl;
     71
    4372    long double _Complex ldc = random();
    4473    sout | ldc | endl;
Note: See TracChangeset for help on using the changeset viewer.