Skip to content
This repository has been archived by the owner on Dec 11, 2020. It is now read-only.

Commit

Permalink
Merge pull request #820 from urisavka/master
Browse files Browse the repository at this point in the history
Use generator to populate values for numeric fields for Spot provider.
  • Loading branch information
fzaninotto committed Feb 4, 2016
2 parents b312ab9 + a7dc285 commit c263831
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/Faker/ORM/Spot/ColumnTypeGuesser.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,20 +38,20 @@ public function guessFormat(array $field)
return $generator->randomNumber($size + 2) / 100;
};
case 'smallint':
return function () {
return mt_rand(0, 65535);
return function () use ($generator) {
return $generator->numberBetween(0, 65535);
};
case 'integer':
return function () {
return mt_rand(0, intval('2147483647'));
return function () use ($generator) {
return $generator->numberBetween(0, intval('2147483647'));
};
case 'bigint':
return function () {
return mt_rand(0, intval('18446744073709551615'));
return function () use ($generator) {
return $generator->numberBetween(0, intval('18446744073709551615'));
};
case 'float':
return function () {
return mt_rand(0, intval('4294967295'))/mt_rand(1, intval('4294967295'));
return function () use ($generator) {
return $generator->randomFloat(null, 0, intval('4294967295'));
};
case 'string':
$size = isset($field['length']) ? $field['length'] : 255;
Expand Down

0 comments on commit c263831

Please sign in to comment.