-
-
Save nojimage/df00550e9cbc412e479ec9d54939cb67 to your computer and use it in GitHub Desktop.
NEVER USE this UUIDv4 generator
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env php | |
<?php | |
/** | |
* composer init && composer require cakephp/utility:^3.8 | |
* | |
* Try < PHP 5.6: ./genuuid4.php 65536 | sort | uniq -d | |
*/ | |
require 'vendor/autoload.php'; | |
use Cake\Utility\Text; | |
function make_seed() | |
{ | |
list($usec, $sec) = explode(' ', microtime()); | |
return $sec + $usec * 1000000; | |
} | |
$repeats = isset($argv[1]) ? (int)$argv[1] : 1; | |
for ($i = 0; $i < $repeats; $i++) { | |
mt_srand(make_seed()); // !! HAHAHAHAHHHAHA !! | |
echo Text::uuid() . "\n"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
なるほど。 > メルセンヌツイスタはそんなに衝突しない - Qiita https://qiita.com/blackenedgold/items/52da300456b1e6e1365a