Commit Graph

7 Commits

Author SHA1 Message Date
Fabio Lima c01a914319 Small optimizations
Optimized methods:
- UlidUtil.fromUuidToUlid()
- UlidUtil.fromUlidToUuid()

Added tests cases:
- UlidUtilTest.testFromUuidToBytes()
- UlidUtilTest.testFromBytesToUuid()
- UlidUtilTest.testToAndFromBytes()

Created classes:
- Benchmarks.java (need to uncomment)
2020-02-25 15:40:35 -03:00
Fabio Lima da8061af21 Fixed a test case
Fixed test case: testShouldThrowOverflowException()
2020-02-24 02:30:07 -03:00
Fabio Lima 7ec2a7cc98 Throw exception when 2^80 requests are made
In the previous implementation an exception was thrown when the random
part reached 2^80. It meant that if the first random generated within a
millisecond was (2^80 - 1000), the generator could thrown the exception
when only 1000 requests was made. It was very difficult, but possible.

Now it only occurs in the extremely unlikely event that you manage to
generate more than 2^80 ULIDs within the same millisecond.
2020-02-23 23:55:34 -03:00
Fabio Lima a89bab3863 Added XorshiftRandom 2020-02-23 14:03:58 -03:00
Fabio Lima f885a03125 Rearranging the code 2020-02-22 13:07:16 -03:00
Fabio Lima 63bee56534 Copied more code from uuid-creator 2020-02-17 01:49:00 -03:00
Fabio Lima 3fbe5c5c1b Copied some code from uuid-creator 2020-02-17 01:34:29 -03:00