Created
November 14, 2015 13:02
-
-
Save Marian0/aef52c074a3a3c57124c to your computer and use it in GitHub Desktop.
Randomizar un array en base a una semilla
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
<?php | |
$array_loco = []; | |
for($i = 0; $i < 1000; $i++) { | |
$array_loco[] = $i; | |
} | |
mt_srand('2'); | |
$order = array_map(create_function('$val', 'return mt_rand();'), range(1, count($array_loco))); | |
array_multisort($order, $array_loco); | |
var_dump($array_loco); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment