()
| 833 | _last_counter_v7 = 0 # 42-bit counter |
| 834 | |
| 835 | def _uuid7_get_counter_and_tail(): |
| 836 | rand = int.from_bytes(os.urandom(10)) |
| 837 | # 42-bit counter with MSB set to 0 |
| 838 | counter = (rand >> 32) & 0x1ff_ffff_ffff |
| 839 | # 32-bit random data |
| 840 | tail = rand & 0xffff_ffff |
| 841 | return counter, tail |
| 842 | |
| 843 | |
| 844 | def uuid7(): |