fzaninotto/Faker — pull request #332 by TimWolla (2014-05-14 21:52:33+00:00)
Title: Biased integer

biasedInteger allows generating an integer that is biased by a given function.

See fzaninotto/Faker#304

See this example data:
![graph](https://cloud.githubusercontent.com/assets/209270/2977894/3b1f61a4-dbb1-11e3-84a3-181ed2a74591.png)

Number	|unbiased|	linearLow|	linearHigh|	sqrt	|square
-------------|------------|------------------|-------------------|------------|---------
1	|9857	|19016|	1007	|3222|	84
2	|10032	|17000|	2931	|5715|	717
3|	9966	|14977|	4928	|7538|	1846
4|	9914	|13015|	7033	|8872|	3645
5|	10099	|11080|	9145	|9915|	6095
6|	9800	|9012	|11001|	11234|	9138
7|	9987	|6860	|12936|	11906|	12800
8|	10096	|5053	|15047|	13160|	17019
9|	10026	|2945	|16919|	13775|	21512
10|	10223	|1042	|19053|	14663|	27144
Loop iterations:	|100000|	200217|	199822	|150115|	299345
Loop iterations (percent)	|100,00%|	200,22%	|199,82%|	150,12%	|299,34%

Loop iterations are the number of times the contents of the loop were executed, `100000` is perfect, no values were discarded.

For even more fascination see this `sqrt` distribution of a higher number range :smile:
![graph2](https://cloud.githubusercontent.com/assets/209270/2977935/e176948c-dbb1-11e3-9b0c-992d48d2d639.png)