SIGN IN SIGN UP

fix(core): clamp uuidv7 RNG output to a valid uint32 so a nonconformant Math.random cannot crash event capture (#4616)

* fix(core): clamp uuidv7 RNG output to a valid uint32

A nonconformant Math.random() that returns >= 1 or NaN (e.g. Hermes on
Android, whose Math.random is built on C++ std::uniform_real_distribution
— documented to occasionally return its upper bound) pushes the uuidv7
random fields out of range, making fromFieldsV7 throw
'RangeError: invalid field value' on every capture and crash-looping RN
apps during the internal event-queue flush. Clamp nextUint32() with
'>>> 0' so a bad random value degrades entropy for that id instead of
throwing; timestamp bits untouched, ids remain spec-valid UUIDv7.

* chore(changeset): include posthog-react-native

---------

Co-authored-by: Shahid R <shahid.rogers@paywatchglobal.com>
Co-authored-by: Manoel Aranda Neto <marandaneto@gmail.com>
S
Shahid R committed
7902e445d0a66b93bd4c7febce04cdf8836ea86b
Parent: a47b232
Committed by GitHub <noreply@github.com> on 8/27/2026, 7:57:49 AM