Skip to content

Commit

Permalink
fix: seeded random function
Browse files Browse the repository at this point in the history
  • Loading branch information
rolznz committed Jan 17, 2025
1 parent 06ae3a0 commit 7845a66
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions frontend/src/components/home/widgets/AppOfTheDayWidget.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ import {

export function AppOfTheDayWidget() {
function seededRandom(seed: number) {
seed = (seed * 48271) % 2147483647; // LCG formula
return (seed - 1) / 2147483646; // Normalize to [0, 1)
const x = Math.sin(seed++) * 10000;
return x - Math.floor(x);
}

const daysSinceEpoch = Math.floor(Date.now() / (1000 * 60 * 60 * 24));
Expand Down

0 comments on commit 7845a66

Please sign in to comment.