$wt) { if (!$choice) { if ($pct_wt <= $wt) { $choice = $name; } else { $pct_wt -= $wt; } } } return $choice; } $good_factor = 5; $shops = array( "Herrell's" => $good_factor, "Ben & Jerry's" => $good_factor, "Lizzie's" => $good_factor, "Berryline" => $good_factor, "J. P. Licks" => $good_factor, "Baskin Robbins" => 1, ); $pct_of_today = 100 * (1 + base_convert(substr(md5(date("dmy")."TOSCANINI'S WAS SO AWESOME"), 7, 2), 16, 10)) / 256.0; $todays_choice = pick_weighted_choice($shops, $pct_of_today); $random_choice = pick_weighted_choice($shops); ?>