Stories
Slash Boxes
Comments

SoylentNews is people

posted by LaminatorX on Thursday December 11 2014, @01:10AM   Printer-friendly
from the select-now() dept.

OpenBSD has taken it upon themselves to fix (or break, depending on your perspective) incorrect random number generation. Now Ted "tedu" Unangst has provided some examples of how not to generate random numbers. You won't believe the shit some programmers do!

 
This discussion has been archived. No new comments can be posted.
Display Options Threshold/Breakthrough Mark All as Read Mark All as Unread
The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
  • (Score: 2) by HiThere on Friday December 12 2014, @08:12PM

    by HiThere (866) Subscriber Badge on Friday December 12 2014, @08:12PM (#125575) Journal

    There are lots of different methods, but they all boil down to you resolve the image into a stream of numbers that you sample. You probably want to calculate a mean value for any particular element that you are are sampling and use the difference from the mean as your random value. You could handle the video as a series of stills and sample variation in any particular part of the image. Or other approaches. Exactly what technique you use would depend on what your purpose was. (Do you need a Normal distribution? A flat distribution? Etc. You probably should prefer modular values over threshold values. Etc.)

    P.S.: I'm no expert in this area, and have only a very nodding acquaintance with the idea, but that's the basic approach.

    --
    Javascript is what you use to allow unknown third parties to run software you have no idea about on your computer.
    Starting Score:    1  point
    Karma-Bonus Modifier   +1  

    Total Score:   2  
  • (Score: 0) by Anonymous Coward on Sunday December 14 2014, @10:15PM

    by Anonymous Coward on Sunday December 14 2014, @10:15PM (#126004)

    Thank you. Now I'm not quite as ignorant :)