Skip to content

Instantly share code, notes, and snippets.

@Marian0
Created November 14, 2015 13:02
Show Gist options
  • Save Marian0/aef52c074a3a3c57124c to your computer and use it in GitHub Desktop.
Save Marian0/aef52c074a3a3c57124c to your computer and use it in GitHub Desktop.
Randomizar un array en base a una semilla
<?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