gregmuellegger/django-autofixture — pull request #21 by ricefield (2013-10-17 20:36:52+00:00)
Title: Weighted generator

Hey Greg, here's a concept I've been working on that I'd appreciate if you could take a look at:

The idea of a "weighted generator" is that you may want to generate different types of datasets in certain ratios. For example, you may have a field for gender, and may want a certain ratios of males to females. Or maybe you assign users to different teams, and you want to ensure there's a certain distribution among the teams.

So a weighted generator takes a list of generators and weights. I wrote two tests to ensure it works within a certain bounds. Right now the `weighted_choice()` method is not very efficient, and I'm looking at a more efficient solution that I feel isn't too many loc.

But I wanted to go ahead and submit the PR and see what you think. Thanks!