Passing a variable via wp_head and then calling it on the page

Before you use your $random_variable for the first time you need to globalize it , something like:

global $random_variable;

then next time or any time you want to access it just call globalize it again and it will be available like this:

global $random_variable;
//do stuff with it