True random number generator

Jonathan T. had recently been afforded the opportunity to go back and tweak the very first Python-based CMS he'd ever built. Years earlier, he and another junior developer had been forced to cobble this site together with no code reviews, oversight, or help of any kind. Terrible choices had been made in the name of getting their work done.

Jonathan rebuilt every page in the CMS and made sure the forms and plugins cooperated with the new structural elements he introduced. In the process, he got stuck trying to figure out how a "col-sm-6" was showing up on a particular form. He found nothing in the CSS, LESS files, or page-specific JS controlling the form. In desperation, he ran a project-wide search for the randomClass.

This was the result Jonathan found in project/scripts.js, authored by the other junior dev. It explained why, for the past several years, new images on the site had randomly not worked for any discernible reason.


$(document).ready(function() {
    $(".randomClass").addClass("col-sm-6");
    $(".otherRandomClass").addClass("col-sm-12");
    $("img[src='https://generic.s3.amazonaws.com/cache/5c/bf/5cbf90e3e6afaa503e3f4b8eaf5a4397.jpg']").addClass('make-short');
    $("img[src='https://generic.s3.amazonaws.com/cache/45/2f/452f62e5a609d293e27f40f31cf9575c.jpg']").addClass('make-short');
    $("img[src='https://generic.s3.amazonaws.com/cache/82/1d/821db6dc5d1388758247726233553218.jpg']").addClass('make-short');
    $("img[src='https://generic.s3.amazonaws.com/cache/9e/7c/9e7c27f45180e53ed2fd8d2efa0c6d66.jpg']").addClass('make-short');

    $("img[src='https://generic.s3.amazonaws.com/cache/a8/71/a871c57d0030082738913b671971a842.jpg']").addClass('make-short');

    $("img[src='https://generic.s3.amazonaws.com/cache/54/db/54dbbfbe645c87d8106d148031bf5df1.jpg']").addClass('make-short');

    $("img[src='https://generic.s3.amazonaws.com/cache/24/8f/248f6f9ca57a61cbeafa22bd7fbb7569.jpg']").addClass('make-short');

    $("img[src='https://generic.s3.amazonaws.com/cache/d8/d1/d8d184223c8d61f19bee78ca7d9e0eaa.jpg']").addClass('make-short');

    $("img[src='https://generic.s3.amazonaws.com/cache/8c/82/8c828ee6feaa0a072a8f0a963ee684ca.jpg']").addClass('make-short');

    $("img[src='https://generic.s3.amazonaws.com/cache/1f/41/1f41c5b6e8f65bc10d3f7ee729e9974e.jpg']").addClass('make-short');

    $("img[src='https://generic.s3.amazonaws.com/cache/a0/ea/a0ea02ddc52be55ef6b7c8c8f9afd6f4.jpg']").addClass('make-short');

    $("img[src='https://generic.s3.amazonaws.com/cache/17/6c/176c72476538e5e4d6c993e67f758ac8.jpg']").addClass('make-short');

    $("img[src='https://generic.s3.amazonaws.com/cache/dc/e7/dce73d9ac7e94958146768f6f4b8d18d.jpg']").addClass('make-short');

    $("img[src='https://generic.s3.amazonaws.com/cache/1f/ab/1fab6033a0b96c6fdfcbe68b66e595bf.jpg']").addClass('make-short');

    $("img[src='https://generic.s3.amazonaws.com/cache/f5/66/f5664772196cd29611bdb34697d0572d.jpg']").addClass('make-short');

    $("img[src='https://generic.s3.amazonaws.com/cache/5c/bf/5cbf90e3e6afaa503e3f4b8eaf5a4397.jpg']").addClass('make-short');
    $("img[src='https://generic.s3.amazonaws.com/cache/5c/bf/5cbf90e3e6afaa503e3f4b8eaf5a4397.jpg']").addClass('make-short');
    $("img[src='https://generic.s3.amazonaws.com/cache/5c/bf/5cbf90e3e6afaa503e3f4b8eaf5a4397.jpg']").addClass('make-short');
    $("img[src='https://generic.s3.amazonaws.com/cache/5c/bf/5cbf90e3e6afaa503e3f4b8eaf5a4397.jpg']").addClass('make-short');
    $("img[src='https://generic.s3.amazonaws.com/cache/5c/bf/5cbf90e3e6afaa503e3f4b8eaf5a4397.jpg']").addClass('make-short');
    $("img[src='https://generic.s3.amazonaws.com/cache/5c/bf/5cbf90e3e6afaa503e3f4b8eaf5a4397.jpg']").addClass('make-short');
});