PHP Classes

File: generate_random_float_numbers_class.php

Recommend this page to a friend!
  Classes of Ovunc Tukenmez  >  Generate random float numbers  >  generate_random_float_numbers_class.php  >  Download  
File: generate_random_float_numbers_class.php
Role: Class source
Content type: text/plain
Description: Class file
Class: Generate random float numbers
Generate random floating point numbers
Author: By
Last change: -
Date: 14 years ago
Size: 530 bytes
 

Contents

Class file image Download
<?php
class generate_random_float_numbers
{
    public
$generated_numbers = array();

    function
__construct($total, $how_many)
    {
       
$i = 0;
        while (
$i != $how_many) {
            if (
$i == $how_many - 1) { $this->generated_numbers[count($this->generated_numbers)] = $total; } else {
               
$this->generated_numbers[count($this->generated_numbers)] = round(lcg_value() * intval($total / rand(1, rand(2, $how_many - $i))), 2);
               
$total -= $this->generated_numbers[count($this->generated_numbers) - 1];
            }
           
$i++;
        }
    }
}
?>

For more information send a message to info at phpclasses dot org.