
Using Garbage Values To Generate Pseudorandom Numbers
Screenshot of a dark code editor showing a C function: a comment reads "//returns a double in the inclusive range 0.0 - 1.0", and get_random_double declares an uninitialized unsigned garbage variable, then returns it divided by UINT_MAX, using a garbage value as a random number.
Good for
- when programmers mock absurd code
- discussing a broken random number implementation
- code review spotting an uninitialized variable
Recommended in
Collected from the web · rights belong to the original authorsWeb
- License
- Web collected
- Source
- programmerhumor.io
- Details
- 803×203 · JPG
Tags
Writing something? Let AI place memes
Paste an article and memes land on the punchlines.