And Bingo was his Name-O
Posted: Tue Sep 06, 2011 7:29 am
Ok I am racking my head I am creating a bingo game for fun... I have function that serves as my hopper. It works pretty good, but sometimes it doesn't have a letter. I would like the result to be something like "G54". I usually get something like that, occasionally I will just get "54".
EDIT: SOLVED: I changed the function up and this seems to work better!
Code: Select all
function thehopper() {
$length = 1;
$characters = 'BINGO';
$letter = $characters[mt_rand(1, strlen($characters))];
$draw = $letter . rand(1,100);
return $draw;
}
$draw = thehopper();
echo $draw;
Code: Select all
function thehopper() {
$alpha = str_split('BINGO');
shuffle($alpha);
$draw = implode('', array_slice($alpha, 0, 1));
$draw = $draw . rand(1,100);
return $draw;
}