Why does this not work?

Why does this not work?

Hi All,
I am fairly new to javaScript and JQuery and am wondering why this code does not work? the switch case does not fire.

$(document).ready(function () {
   
var numRand = Math.floor(Math.random() * 20);
var Name;

   switch (numRand)
    {
        case '19': Name = "c5";
            alert(numRand);       
            break;
        case '18': Name = "b4";
            alert(numRand);
            break;
     
        default: Name = "f2";
        }

  
});

While this code will?

$(document).ready(function () {
 
  var numRand = "19";
 
    var Name;

   switch (numRand)
    {
        case '19': Name = "c5";
            alert(numRand);       
            break;
        case '18': Name = "b4";
            alert(numRand);
            break;
     
        default: Name = "f2";
        }

  
});

When directly assign the var numRand a value the switch case works and the var Name is assigned the appropriate value. While if I assign numRand via Math.floor(Math.random() * 20); the switch case will not work?
Also it seems that you can only use a variable once as the alert statements do not ever fire within the switch case statement.

Thanks for the help in advance

Gehres Weed