The files are fonts, it's common for them to have names like FontName-type.extension
I have them all together in a single folder, I currently have this function:
function random_font($dir = 'fonts')
{
$fonts = glob($dir . '/*');
return $fonts[devurandom_rand(0, count($fonts) - 1)];
}
The goal is however to get as representative a sample as possible, and fonts that share a FontName are much more similiar to each other than those that don't.
My problem is selecting a font at random such that fonts that share FontName also share the probability of being selected.
Aucun commentaire:
Enregistrer un commentaire