Skip to content

Commit a21ca54

Browse files
committed
fix(sample): avoid bitwise GUID generation
1 parent 6448589 commit a21ca54

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

ExpoTestApp/App.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ const eventManagerEmitter = new NativeEventEmitter(RoktEventManager);
2929
const generateGuid = () =>
3030
'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, character => {
3131
const random = Math.floor(Math.random() * 16);
32-
const value = character === 'x' ? random : (random & 0x3) | 0x8;
32+
const value = character === 'x' ? random : 8 + (random % 4);
3333
return value.toString(16);
3434
});
3535

sample/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ const eventManagerEmitter = new NativeEventEmitter(MParticle.RoktEventManager);
2929
const generateGuid = () =>
3030
'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, character => {
3131
const random = Math.floor(Math.random() * 16);
32-
const value = character === 'x' ? random : (random & 0x3) | 0x8;
32+
const value = character === 'x' ? random : 8 + (random % 4);
3333
return value.toString(16);
3434
});
3535

0 commit comments

Comments
 (0)