Changeset 2 in Project Repository for src/random.cpp


Ignore:
Timestamp:
08/14/2012 11:04:35 AM (8 years ago)
Author:
pchapin
Message:

Reformatted the comments in the existing source files.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/random.cpp

    r1 r2  
    11/**************************************************************************** 
    2 FILE          : random.cpp 
    3 LAST REVISION : 2005-11-21 
    4 SUBJECT       : Implementation of random number abstract class. 
    5 PROGRAMMER    : (C) Copyright 2005 by Peter C. Chapin 
     2FILE      : random.cpp 
     3SUBJECT   : Implementation of random number abstract class. 
     4PROGRAMMER: (C) Copyright 2012 by Peter C. Chapin 
    65 
    7 This file contains the implementation of the non-inline member functions of 
    8 the various random number classes. 
    9  
    10 Please send comments or bug reports to 
    11  
    12      Peter C. Chapin 
    13      Electrical and Computer Engineering Technology 
    14      Vermont Technical College 
    15      Randolph Center, VT 05061 
    16      pchapin@ecet.vtc.edu 
    176****************************************************************************/ 
    187 
     
    2312namespace rnd { 
    2413 
    25   // This method will return non-random results if the underlying 
    26   // generator has a maximum value that is not near a power of two. 
    27   // Ideally it should be a power of two minus 1. Otherwise when the 
    28   // mask reaches the most significant bit, it will see an excessive 
    29   // number of zero bits there. 
     14  // This method will return non-random results if the underlying generator has a maximum value 
     15  // that is not near a power of two. Ideally it should be a power of two minus 1. Otherwise 
     16  // when the mask reaches the most significant bit, it will see an excessive number of zero 
     17  // bits there. 
    3018  // 
    3119  unsigned bit_random::next() 
     
    4230    bit = (current & mask) ? 1 : 0; 
    4331 
    44     // Advance the mask, taking care not to overflow unsigned or go off 
    45     // the end of the values coming back from the underlying generator. 
     32    // Advance the mask, taking care not to overflow unsigned or go off the end of the values 
     33    // coming back from the underlying generator. 
    4634    // 
    4735    if (mask > (std::numeric_limits<unsigned>().max() >> 1)) { 
     
    5644 
    5745 
    58   // This implementation uses the output of std::time to seed the random 
    59   // number generator. There are numerous problems with doing this, but 
    60   // some applications are not concerned by them. 
     46  // This implementation uses the output of std::time to seed the random number generator. There 
     47  // are numerous problems with doing this, but some applications are not concerned by them. 
    6148  // 
    6249  void seeded_random::time_seed() 
Note: See TracChangeset for help on using the changeset viewer.