Possible Duplicate:
Getting a random value from a JavaScript array

OK, so I have three variables here, each being rock, paper or scissors. Using JavaScript, how can I generate one of those words randomly?

So far it's like so:

<!DOCTYPE html>
<html>
    <body>
        <button type="button" onclick="myFunction()"> Click me</button>

        <script>
            function myFunction()
            {
                var c="Rock";
                var d="Paper";
                var e="Scissors";
            }
        </script>
    </body>
</html>

Then I'll have a variable called K, which will be the random word out of rock paper or scissors. So it'll be like so:

alert("The computer chose: " + k);

So how can I make JavaScript select randomly between the three variables, c, d and e?

Edit
Report