You are here: Re: generate 2 random numbers in rapid sequence « PHP Programming Language « IT news, forums, messages
Re: generate 2 random numbers in rapid sequence

Posted by Domestos on 04/23/06 04:19

A less computationally expensive method of accomplishing the same thing is
to use the mt_rand() function. This function uses the Mersenne Twister
algorithm and is considerably faster than rand(). In addition as of PHP
version 4.2.0 there is no need to seed the mt_rand() random number generator
with srand() or mt_srand()

<?php

// Range of numbers

// Minimum number
$min = "1";

// Maximum number
$max = "10";

echo "mt_rand() Mersenne Twister pseudo-random number: ".
mt_rand($min, $max);

?>

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация