Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
NEVER USE this UUIDv4 generator
#!/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";
}
@nojimage

This comment has been minimized.

Copy link
Owner Author

@nojimage nojimage commented Nov 26, 2019

なるほど。 > メルセンヌツイスタはそんなに衝突しない - Qiita https://qiita.com/blackenedgold/items/52da300456b1e6e1365a

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.