I want to change the order of a string based on what day of the month it is.
For example, say the word is "PIZZAS", on the 1st of May it will be "ZZSIPA", and on the 2nd of May it will be "APIZZS" etc...
The code I run works for Math.random(), however when I assign it the value of the day of the month, it does not change.
const dayOfMonth = new Date().getDate();
function shuffle(s) {
var arr = s.split('');
for (let i = arr.length -1; i > 0; i--) {
let j = Math.floor(dayOfMonth * i)
let k = arr[i]
arr[i] = arr[j]
arr[j] = k
}
s = arr.join('');
return s; // Return shuffled string
}
var s = shuffle("PIZZAS");