Randomizer App For Airport Security Cost $47,400

Airport Terminal

While Government waste is nothing new, this story takes it to another level. A randomizer app that the US Department of Homeland Security’s Transportation Security Agency (TSA) ordered, reportedly cost US taxpayers over $47,000.

So it’s a smart app, right?

It is a randomizer app deployed to tablets at TSA checkpoints. It randomly selects a queue for passengers to line up at. With a price tag like that, you’d think it’s smart randomizer app that can select the shortest queue available amongst multiple queue options. Think again! It’s a simple “go-left” or “go-right” randomizer. Check out this video:

Though the app was part of a larger $1.4 million contract, it still seems like a huge waste of money. Considering it only points left or right randomly, it is essentially just a random number generator. It is so easy to do that it seems like a sample program written for a high school programming class.

Do you want to recreate this $47,000 randomizer app? Why not…

Here is the code needed… all 28 lines of it:

<?php 
  $arrow = "press";
  if (isset($_POST['gen'])) {
    header("Refresh:1");
    if(rand(1,1000) % 2 == 0) {
      $arrow = "left";
    } else {
      $arrow = "right";
    }
  };
?>
<!DOCTYPE html>
<html lang="en">
  <head>
    <title>Randomizer App</title>
  </head>
  <body>
    <form method="post">
      <button name="gen" value="blue">
        <img width="100%" 
             height="100%" 
             src="<?php echo $arrow; ?>.png"
             alt="arrow"
        />
      </button>
    </form> 
  </body>
</html>

That’s a whopping $1,692.86 per line.

The above code assumes you have 3 images called press.png to tell you to press the button, left.png to tell you to go left, and right.png to tell you to go right. It starts by initializing a variable called $arrow and setting it to the string “press”. This variable is used further down in the HTML <img> tag to call up one of the above 3 button images.

Next, check whether the $_POST array, which is set by our form submission, has a “gen” value set. If a value for “gen” is set, it sets a page header to refresh itself after 1 second so that we only see the arrow for 1 second. We then generate a random number from 1 to 1000 and divide it by 2 using a modulus function to determine if there is a remainder. If the randomly generated number is divisible by 2 then there will be no remainder and our modulus will return 0. in this case we’ll change the value of $arrow to “left” and call up our left arrow. Otherwise we’ll set $arrow to “right” to call up the right arrow.

Now, you might think to yourself that this is not something that can run on iOS… Or is it? Oh, but it is. Using something called a WebView you can take any webpage and turn it into a native app. Both iOS and Android have this capability and have had it for a very long time.

I really should rename this post to: How Not to Get Swindled Out of Your Hard Earned Money!