Hi All,
My script is reading a log file line by line
log file is like ;
19:40:22 :INFO Total time taken to Service External Request---115ms
19:40:25 DEBUG : Batch processed libdaemon.x86_64 0-0.10-5.el5 - u
19:40:22 INFO Total time taken to Service External Request---20ms
19:40:24... (4 Replies)
Hey. This is pretty easy stuff but I'm learning the basics of Unix at the moment so keep that in mind. I have to:
1) Write a C-shell script to monitor user activity on the server for 13 minutes.
2) Then print the smallest and largest number of users during these 13 minutes.
I have this:
1)... (2 Replies)
Hi All,
My file is like this:
$ cat max.txt
abcd:1982:a
efghij:1980:e
klmn:1923:k
opqrst:1982:o
I have to find out the largest first field and the corresponding line. i.e
Output required:
efghij efghij:1980:e
opqrst opqrst:1982:o
HTH,
jkl_jkl (6 Replies)
I have two text files like this:
file1.txt:
133 10
133 22
133 13
133 56
133 78
133 98
file2.txt:
158 38
158 67
158 94
158 17
158 23
I'm basically trying to have awk check the second largest value of the second column of each text file, and cat it to its own text file. There... (13 Replies)
Hi !
Here is an example of a tab-delimited file with variable width values in field 2 (space separated values).
As the real file contains lot of lines, I can adjust manually the width to the largest value in field 2.
Does it exist an argument to do it automatically?
input.tab:... (4 Replies)
Hi All
I need to find the smallest values between replicates id (column1)
Input file:
a name1 1200
a name2 800
b name1 100
b name2 150
b name3 4output:
a name2 800
b name3 4
Do you have any suggestion?
Thank you! (9 Replies)
`awk` function looks like this in a file name `fun.awk`:
{
print small()
}
function small()
{
a=$0
smal=0
for(i=1;i<=3;i++)
{
if( a<a)
smal=a
else (4 Replies)
In the below I am trying to use awk to match all the $13 values in input, which is tab-delimited,
that are in $1 of gene which is just a single column of text.
However only the line with the greatest $9 value in input needs to be printed.
So in the example below all the MECP2 and LTBP1... (0 Replies)
Discussion started by: cmccabe
0 Replies
LEARN ABOUT PHP
mt_rand
MT_RAND(3) 1 MT_RAND(3)mt_rand - Generate a better random valueSYNOPSIS
int mt_rand (void )
DESCRIPTION
int mt_rand (int $min, int $max)
Many random number generators of older libcs have dubious or unknown characteristics and are slow. By default, PHP uses the libc random
number generator with the rand(3) function. The mt_rand(3) function is a drop-in replacement for this. It uses a random number generator
with known characteristics using the Mersenne Twister, which will produce random numbers four times faster than what the average libc
rand() provides.
If called without the optional $min, $max arguments mt_rand(3) returns a pseudo-random value between 0 and mt_getrandmax(3). If you want a
random number between 5 and 15 (inclusive), for example, use mt_rand(5, 15).
Caution
This function does not generate cryptographically secure values, and should not be used for cryptographic purposes. If you need a
cryptographically secure value, consider using random_int(3), random_bytes(3), or openssl_random_pseudo_bytes(3) instead.
PARAMETERS
o $min
- Optional lowest value to be returned (default: 0)
o $max
- Optional highest value to be returned (default: mt_getrandmax(3))
RETURN VALUES
A random integer value between $min (or 0) and $max (or mt_getrandmax(3), inclusive), or FALSE if $max is less than $min.
CHANGELOG
+--------+---------------------------------------------------+
|Version | |
| | |
| | Description |
| | |
+--------+---------------------------------------------------+
| 5.3.4 | |
| | |
| | Issues an E_WARNING and returns FALSE if $max < |
| | $min. |
| | |
+--------+---------------------------------------------------+
EXAMPLES
Example #1
mt_rand(3) example
<?php
echo mt_rand() . "
";
echo mt_rand() . "
";
echo mt_rand(5, 15);
?>
The above example will output something similar to:
1604716014
1478613278
6
NOTES
Caution
The distribution of mt_rand(3) return values is biased towards even numbers on 64-bit builds of PHP when $max is beyond 2^32. This
is because if $max is greater than the value returned by mt_getrandmax(3), the output of the random number generator must be scaled
up.
SEE ALSO mt_srand(3), mt_getrandmax(3), random_int(3), random_bytes(3), openssl_random_pseudo_bytes(3), rand(3).
PHP Documentation Group MT_RAND(3)