Crypt_Random
[ class tree: Crypt_Random ] [ index: Crypt_Random ] [ all elements ]

Procedural File: Random.php

Source Location: /lib/3rdParty/phpseclib/Crypt/Random.php



Page Details:

Random Number Generator

PHP versions 4 and 5

Here's a short example of how to use this library:

  1.  <?php
  2.     include('Crypt/Random.php');
  3.  
  4.     echo crypt_random();
  5.  ?>

LICENSE: This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA




Tags:

author:  Jim Wigginton <terrafrost@php.net>
version:  $Id: Random.php,v 1.1 2010/05/14 14:06:16 gruberroland Exp $
copyright:  MMVII Jim Wigginton
link:  http://phpseclib.sourceforge.net
license:  http://www.gnu.org/licenses/lgpl.txt








crypt_random [line 57]

Integer crypt_random( [optional $min = 0], [optional $max = 0x7FFFFFFF])

Generate a random value.

On 32-bit machines, the largest distance that can exist between $min and $max is 2**31. If $min and $max are farther apart than that then the last ($max - range) numbers.

Depending on how this is being used, it may be worth while to write a replacement. For example, a PHP-based web app that stores its data in an SQL database can collect more entropy than this function can.




Tags:

access:  public


Parameters

optional   $min   Integer $min
optional   $max   Integer $max
[ Top ]



Documentation generated on Thu, 28 Oct 2010 21:00:30 +0200 by phpDocumentor 1.4.1