17
$\begingroup$

What's this then?

private function pick():void {
    var sample:Array = ["Coconut", "Chocolate Covered Peanuts", "Caramel",
        "Chocolate Covered Almonds", "Chocolate Whip", "Pecan & English Walnut Cluster",  
        "Molasses Chew", "Messenger Boy", "Almond Nougat", "Cashew Cluster",
        "Chocolate Truffle", "Toffee", "Cherry Cordial", "Maple Fudge"
    ];
    var i:int = Math.random() * (sample.length) + 0;
    var existence:String = sample[i];
}
$\endgroup$
  • $\begingroup$ Just to be clear, this is written in Actionscript3, which may pass by value, pass by reference, call-by-sharing, call-by-object, or call-by-object-sharing (which is a special case of pass-by-value).. :) $\endgroup$ – Chowzen May 24 '16 at 4:08
  • $\begingroup$ Gee, I hope I don't get "Messenger Boy!" $\endgroup$ – Chowzen Jun 5 '16 at 7:50
22
$\begingroup$

It's something my mother used to tell me:

Life is like a box of chocolates. You never know what you're going to get!

Explanation:

Life is a synonym for existence; the array is the box of chocolates; picking a random one basically means you don't know what you're going to get; and the quote is from Forrest Gump.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.