Skip to content

Instantly share code, notes, and snippets.

@akkunchoi
Created February 2, 2012 16:19
Show Gist options
  • Save akkunchoi/1724338 to your computer and use it in GitHub Desktop.
Save akkunchoi/1724338 to your computer and use it in GitHub Desktop.
Make dummy data
<?php
$map = array();
for ($i = 0; $i < 10; $i++){
$map[] = chr(ord('0') + $i);
}
for ($i = 0; $i < 26; $i++){
$map[] = chr(ord('A') + $i);
}
for ($i = 0; $i < 26; $i++){
$map[] = chr(ord('a') + $i);
}
$out = '';
$id = 1;
for ($i = 1; $i <= 1000000; $i++){
for ($j = 1; $j <= 40; $j++){
// $key = randStr(mt_rand(9, 20));
$key = $j;
$value = randStr(mt_rand(10, 50));
$id++;
$out .= "$id,$i,$key,$value\n";
}
file_put_contents('dummy.txt', $out, FILE_APPEND);
$out = '';
echo "$i\n";
}
function randStr($len){
global $map;
$ret = '';
for ($i = 0; $i < $len; $i++){
$ret .= $map[mt_rand(0, 61)];
}
return $ret;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment