Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

gmp_random(3) [php man page]

GMP_RANDOM(3)								 1							     GMP_RANDOM(3)

gmp_random - Random number

SYNOPSIS
GMP gmp_random ([int $limiter = 20]) DESCRIPTION
Generate a random number. The number will be between zero and the number of bits per limb multiplied by $limiter. If $limiter is negative, negative numbers are generated. A limb is an internal GMP mechanism. The number of bits in a limb is not static, and can vary from system to system. Generally, the number of bits in a limb is either 16 or 32, but this is not guaranteed. PARAMETERS
o $limiter - The limiter. Either a GMP number resource in PHP 5.5 and earlier, a GMP object in PHP 5.6 and later, or a numeric string pro- vided that it is possible to convert the latter to a number. RETURN VALUES
A random GMP number. EXAMPLES
Example #1 gmp_random(3) example <?php $rand1 = gmp_random(1); // random number from 0 to 1 * bits per limb $rand2 = gmp_random(2); // random number from 0 to 2 * bits per limb echo gmp_strval($rand1) . " "; echo gmp_strval($rand2) . " "; ?> The above example will output: 1915834968 8642564075890328087 PHP Documentation Group GMP_RANDOM(3)

Check Out this Related Man Page

GMP_CLRBIT(3)								 1							     GMP_CLRBIT(3)

gmp_clrbit - Clear bit

SYNOPSIS
void gmp_clrbit (GMP $a, int $index) DESCRIPTION
Clears (sets to 0) bit $index in $a. The index starts at 0. PARAMETERS
o $a -Either a GMP number resource in PHP 5.5 and earlier, a GMP object in PHP 5.6 and later, or a numeric string provided that it is possible to convert the latter to a number. o $index - The index of the bit to clear. Index 0 represents the least significant bit. RETURN VALUES
A GMP number resource in PHP 5.5 and earlier, or a GMP object in PHP 5.6 and later. EXAMPLES
Example #1 gmp_clrbit(3) example <?php $a = gmp_init("0xff"); gmp_clrbit($a, 0); // index starts at 0, least significant bit echo gmp_strval($a) . " "; ?> The above example will output: 254 NOTES
Note Unlike most of the other GMP functions, gmp_clrbit(3) must be called with a GMP resource that already exists (using gmp_init(3) for example). One will not be automatically created. SEE ALSO
gmp_setbit(3), gmp_testbit(3). PHP Documentation Group GMP_CLRBIT(3)
Man Page

4 More Discussions You Might Find Interesting

1. HP-UX

GMP multi precision math library

Hello all, I'm having trouble building the GNU Multi Precision (GMP 4.1.3) on the HP Intel Itanium 2 HP-UX 11i I'm hoping someone out there has had some experience building GMP on this platform. After running the ./configure and doing a make I get an error saying: `.rodata` is not a section ... (3 Replies)
Discussion started by: vyl
3 Replies

2. Programming

Library linking with GMP

I am trying to set up the gnu multiple precision arithmetic library for some c++ programming I have to do. I am using a system with mac osx 10.6.3 and do NOT have root user access. I'm trying to use gmp 5.0.1. Since I don't have root user access, I had to install to a different directory Thus... (3 Replies)
Discussion started by: bluejayek
3 Replies

3. Shell Programming and Scripting

Convert MS Excel file to Tab limiter file in UNIX

Hi, We have a couple of ms excel files in unix server.We need convert the excel files to files TAB limiter format file with using unix script. Could you please advise on this (2 Replies)
Discussion started by: koti_rama
2 Replies

4. Shell Programming and Scripting

Generating a Random String of 'n' length

Hi, How can I generate a string of random characters (alpha+numeric) of a particular length ? For e.g. for n=5, output = 'kasjf' n=10, output = 'hedbcd902k' Also, please let me know if random (valid) dates could also be generated. Thanks (7 Replies)
Discussion started by: rishigc
7 Replies