-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support platform specific second precision (#1946)
This inspects the platform and defines a platform specific property for generating random seconds. For windows this uses `random.randint` as used before and for everything else `random.uniform`, which returns floats instead of ints. Then later on when trying to generate a random number of seconds this proper is then used to get the function that can return values with the correct behaviour. I tried setting the function directly on `self` in an `__init__`, but that worked poorly when seeding the faker after creation, as seeding recreates the internal random instance, so it requires some lazy evaluation to be able to point to the correct random instance in all cases. Internally the points in time is still just ints. Changing those to floats is not strictly important, and would just add noise to diff - making it harder to review.
- Loading branch information
Showing
2 changed files
with
43 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters