es-ude / es-ude/OnDeviceTraining

data_loader/rng: shuffleSeed is uint64_t but rngSetSeed takes uint32_t — silent truncation

Open
#396 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
C
Stars
1
Forks
3
Avg merge
1d 1h
Merged PRs (30d)
8

Description

Found during the #381 review (pre-existing, untouched by the quick-wins PR):

`dataLoader_t.shuffleSeed` is declared `uint64_t` (DataLoader.h), but `initDataLoader` passes it to `rngSetSeed`, which takes `uint32_t` — the upper 32 bits are silently discarded. Two seeds differing only in the high word produce identical shuffles.

Fix options: (a) narrow the field to `uint32_t` (breaking, honest — matches the global XorShift32 state width and the Python mirror), or (b) fold the high word in (e.g. xor) before seeding. Option (a) preferred: the RNG is 32-bit by design and byte-mirrored in Python; a 64-bit seed surface is a false promise.

Regression test: two loaders seeded `0x1` and `0x1_0000_0001` must produce different permutations (currently identical).

Contributor guide

Open the contributing guide

Research direction

Read DataLoader.h, initDataLoader, and rngSetSeed first, then inspect the Python mirror mentioned in the issue to confirm the intended 32-bit seed surface. Add regression coverage for loaders seeded with 0x1 and 0x1_0000_0001, and reconcile that expected behavior with the issue’s preferred narrowing option before marking the work done.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
embedded-iot
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
65/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.