Ensure Proper Client-Side Randomization of Quiz Cards in Quiz Mode
Description
The quiz mode relies entirely on client-side logic (no backend), meaning each session is generated fresh in the browser. We need to verify that quiz cards are properly randomized on each run and that the implementation produces unbiased and non-repetitive ordering.
Objective
Ensure that the client-side shuffle logic correctly randomizes quiz cards so that:
- Each page load or quiz start produces a new card order
- All cards have an equal probability of appearing in any position
- The randomness is not affected by deterministic patterns or flawed algorithms
Scope of Work
- Review the current client-side randomization logic (e.g., array shuffling)
- Confirm use of a proper unbiased algorithm (e.g., Fisher–Yates shuffle)
- Validate that randomization runs on every quiz initialization (not cached or reused)
- Test behavior across multiple page reloads and quiz restarts
- Optionally log or simulate multiple runs to observe distribution patterns
Acceptance Criteria
- Card order changes between page reloads and quiz restarts
- No duplicate or missing cards within a single session
- Distribution of card positions appears uniform over repeated trials
- Randomization is handled entirely on the client without reliance on persisted state
- Code is documented to explain the chosen randomization approach
Additional Notes
- Since there is no backend, randomness depends on browser-provided APIs (e.g.,
Math.random()), which should be sufficient for this use case
- Avoid using
array.sort(() => Math.random() - 0.5) as it introduces bias
- Keep implementation lightweight and performant for a static web app
Ensure Proper Client-Side Randomization of Quiz Cards in Quiz Mode
Description
The quiz mode relies entirely on client-side logic (no backend), meaning each session is generated fresh in the browser. We need to verify that quiz cards are properly randomized on each run and that the implementation produces unbiased and non-repetitive ordering.
Objective
Ensure that the client-side shuffle logic correctly randomizes quiz cards so that:
Scope of Work
Acceptance Criteria
Additional Notes
Math.random()), which should be sufficient for this use casearray.sort(() => Math.random() - 0.5)as it introduces bias