Tärning | Visa källkod | Hangman | XHTML | CSS | How to become a hacker

Visa källkod

Nedanstående filer finns i denna katalogen. Klicka på en fil för att visa dess innehåll.

dice6/

CDice.php
CDiceSvg.php
CHistogram.php
FDice.php
FHistogram.php
common.php
dice.php
source.php
template.php

FDice.php
<?php
// ===========================================================================================
//
// FDice.php
//
// Description: Functions for a dice
//
// Author: Mikael Roos
//


// -------------------------------------------------------------------------------------------
//
// Throw a dice, return the value.
//
function diceThrow() {
    return rand(1,6);
}


// -------------------------------------------------------------------------------------------
//
// Throw a dice repeatedly, return the value(s).
//
function diceThrowRepeatedly($aNumber) {
    $throws = Array();
    for($i=1; $i<=$aNumber; $i++) {
        $throws[$i] = diceThrow(); 
    }    
    return $throws;
}


?>
 .                        
..:    © Mikael Roos, 2009