Get random Page and fix result (dataview)

Hi everyone,

I have a usecase where i want to create a daily page for training and within that page i want to reference to a random different page within a special folder.

I allready got this code that works totally fine, but i want to fix the result and not to change it after a certain time.
So for each daily note I would have a random exercise getting picked for me.

let random = (function (a, b, now = Date.now()) {
    let msRefreshRate = 1000*60*60*24
    a = b = (now - (now%(msRefreshRate)));
  return function () {
      a = (a * 67307) & 0xffff;
      b = (b * 67427) & 0xffff;
      return a ^ (b << 15);
  };
})();
let numberOfLinks = 5
dv.table([],
	dv.pages('"Taekwondo/Aufwärmspiele"')
	    .sort(() => random() - random())
	    .slice(0, numberOfLinks)
	    .map(p => [p.file.link])
);

Hope you guys can help :slight_smile:

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.