Conditions | 1 |
Paths | 1 |
Total Lines | 22 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
7 | static public function generateV4() |
||
|
|||
8 | { |
||
9 | return sprintf( '%04x%04x-%04x-%04x-%04x-%04x%04x%04x', |
||
10 | // 32 bits for "time_low" |
||
11 | mt_rand( 0, 0xffff ), mt_rand( 0, 0xffff ), |
||
12 | |||
13 | // 16 bits for "time_mid" |
||
14 | mt_rand( 0, 0xffff ), |
||
15 | |||
16 | // 16 bits for "time_hi_and_version", |
||
17 | // four most significant bits holds version number 4 |
||
18 | mt_rand( 0, 0x0fff ) | 0x4000, |
||
19 | |||
20 | // 16 bits, 8 bits for "clk_seq_hi_res", |
||
21 | // 8 bits for "clk_seq_low", |
||
22 | // two most significant bits holds zero and one for variant DCE1.1 |
||
23 | mt_rand( 0, 0x3fff ) | 0x8000, |
||
24 | |||
25 | // 48 bits for "node" |
||
26 | mt_rand( 0, 0xffff ), mt_rand( 0, 0xffff ), mt_rand( 0, 0xffff ) |
||
27 | ); |
||
28 | } |
||
29 | } |
||
30 |