Changes between Version 2 and Version 3 of RandomnessArcfide


Ignore:
Timestamp:
07/10/16 18:06:03 (15 months ago)
Author:
cowan
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • RandomnessArcfide

    v2 v3  
    1 = Simple Randomness = 
    2  
    3 Aaron Hsu 
    4  
    5 == Abstract == 
    6  
    7 The following proposal provides a simple, minimal interface to random number generation. It allows both controlled random seeding and also a single procedure that provides randomness. It is designed to be simple and fairly useful. 
    8  
    9 == Rationale == 
    10  
    11 Randomness is a common feature to use in education and general programming. Therefore, it makes sense to have WG1 standardize randomness to some degree. The current proposals on the table are either too complex or do not provide the necessary features. Specifically, when teaching about randomness, it is important to be able to control the way that randomness falls out when grading assignments or testing them.  
    12  
    13 == Specification == 
    14  
    15  `(random` ''real''`)`:: 
    16  Returns a random value in the range [0.0, ''real''). When given an exact integer, the values returned must be exact integers; otherwise it will return a real value. 
    17  
    18  `(random-seed)`:: 
    19  A parameter like procedure that allows the seed to be set and accessed. The procedure may be passed a single non-negative exact integer to set a specific seed, and this must be supported on all Schemes, but Schemes may optionally support different seed values. 
    20  
    21 == Design Rationale == 
    22  
    23 I do not see any reason to have two procedures for getting a random value. These can be combined into one without requiring much trouble. Additionally, this one procedure is more general than the two procedures suggested by RandomCowan. It is also more simple than SRFI-27. The possibility of returning a 0.0 value from `random` is intentional to make the procedure behave in a more consistent manner. This should not be a problem, as suggested by RandomCowan, with `log` if `(log 0.0)` is defined to return `-inf.0`.  
     1This was a minimal randomness proposal for WG1, which decided not to provide random numbers.  For WG2 purposes, it is superseded by [http://srfi.schemers.org/srfi-27/srfi-27.html SRFI 27].