Changeset 36103 in project


Ignore:
Timestamp:
08/10/18 23:47:29 (19 months ago)
Author:
sjamaan
Message:

Porting guide: Document what we did to "random"

File:
1 edited

Legend:

Unmodified
Added
Removed
  • wiki/porting-c4-to-c5

    r36084 r36103  
    330330
    331331
     332=== Random
     333
     334The {{random}} procedure produced very weak random numbers, so we've
     335deleted it.  Instead, you can import [[/man/5/Module (chicken
     336random)|{{(chicken random)}}]] and use {{pseudo-random-integer}},
     337which should produce random numbers in the range between 0 and the
     338number you supply (exclusive).  Its argument '''must''' be an exact
     339integer.
     340
     341If before you would divide by a floating-point number to get a number
     342in the range 0..1, you can now use {{(pseudo-random-real)}}, which
     343will do the same thing, but in a better way.
     344
     345If you need to initialize the PRNG to a known state, instead of
     346{{randomize}}, you can use {{set-pseudo-random-seed!}}, but be aware
     347that the numbers you'll get will be different.
     348
     349For cryptographic uses or other uses that require "really" random
     350numbers, you can use {{random-bytes}}, which returns numbers from the
     351operating system's entropy source.
     352
    332353=== Fixing more subtle issues
    333354
Note: See TracChangeset for help on using the changeset viewer.