Changeset 28 in Project Repository


Ignore:
Timestamp:
09/16/2014 03:30:47 PM (6 years ago)
Author:
pchapin
Message:

Reformatted the comments to a wide of 96 columns.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/random.ads

    r27 r28  
    1313   function Maximum(G : in Generator) return Number_Type is abstract; 
    1414 
    15    -- Return the next random number from the generator. Notice that the generator's state is updated. 
     15   -- Return the next random number from the generator. Notice that the generator's state is 
     16   -- updated. 
    1617   function Next(G : in out Generator) return Number_Type is abstract 
    1718     with Post'Class => (0 <= Next'Result and Next'Result <= Maximum(G)); 
    1819 
    19    -- Returns a random number in the given range (inclusive). Notice that the generator's state is updated. The precondition 
    20    -- ensures that every value in the desired range might be returned. Warning! If the maximum of the generator is not an 
    21    -- integer multiple of the size of the desired range, the output will be biased. Values in the upper part of the range will 
    22    -- not occur frequently enough. 
     20   -- Returns a random number in the given range (inclusive). Notice that the generator's state 
     21   -- is updated. The precondition ensures that every value in the desired range might be 
     22   -- returned. Warning! If the maximum of the generator is not an integer multiple of the size 
     23   -- of the desired range, the output will be biased. Values in the upper part of the range 
     24   -- will not occur frequently enough. 
    2325   function Next(G : in out Generator'Class; Low, High : Number_Type) return Number_Type 
    2426     with Pre => (High >= Low) and then (Maximum(G) >= (High - Low + 1)); 
     
    4042   --------------------- 
    4143 
    42    -- This type returns individual bits using a given underlying generator to obtain them. Warning! If the underlying generator 
    43    -- has a maximum that is not 2**N - 1 for some N, the bits returned here will have bias. This is because the most significant 
    44    -- bit of the output of the underlying generator will be set with a probability less than 0.5. 
     44   -- This type returns individual bits using a given underlying generator to obtain them. 
     45   -- Warning! If the underlying generator has a maximum that is not 2**N - 1 for some N, the 
     46   -- bits returned here will have bias. This is because the most significant bit of the output 
     47   -- of the underlying generator will be set with a probability less than 0.5. 
    4548   type Bit_Generator is new Generator with private; 
    4649 
    47    -- The access parameter on Make allows several Bit_Generators to share the same underlying generator. 
     50   -- The access parameter on Make allows several Bit_Generators to share the same underlying 
     51   -- generator. 
    4852   not overriding function Make(G : access Generator'Class) return Bit_Generator; 
    4953   overriding function Maximum(B : in Bit_Generator) return Number_Type 
     
    5660   --------------------- 
    5761 
    58    -- This type returns individual bits using a given underlying generator to obtain them. It returns the least significant bit 
    59    -- of each value generated by the underlying generator. This is wasteful of random bits, but it means it is free of the bias 
    60    -- problems of Bit_Generator. Warning! Maybe pseudo-random generators do a poor job of randomizing the LSB of their output. 
     62   -- This type returns individual bits using a given underlying generator to obtain them. It 
     63   -- returns the least significant bit of each value generated by the underlying generator. 
     64   -- This is wasteful of random bits, but it means it is free of the bias problems of 
     65   -- Bit_Generator. Warning! Maybe pseudo-random generators do a poor job of randomizing the 
     66   -- LSB of their output. 
    6167   type LSB_Generator is new Generator with private; 
    6268 
    63    -- The access parameter on Make allows several LSB_Generators to share the same underlying generator. 
     69   -- The access parameter on Make allows several LSB_Generators to share the same underlying 
     70   -- generator. 
    6471   not overriding function Make(G : access Generator'Class) return LSB_Generator; 
    6572   overriding function Maximum(B : in LSB_Generator) return Number_Type 
     
    7279   --------------------------- 
    7380 
    74    -- This type always has exactly 1_771_875 states. The parameters of the generator are fixed. Warning! Generators of this type 
    75    -- are unsuitable for security sensitive applications. 
     81   -- This type always has exactly 1_771_875 states. The parameters of the generator are fixed. 
     82   -- Warning! Generators of this type are unsuitable for security sensitive applications. 
    7683   type Linear_Congruential is new Seeded_Generator with private; 
    7784 
Note: See TracChangeset for help on using the changeset viewer.