How to add links to random notes to daily note

I guess you didn’t see the note I made on tR, or understood it, for the following code only stores the result of the code into your new note:

<%* 
const noOfNotes = 5
const files = app.vault.getFiles()

for (let i = 0; i < noOfNotes; i++) {
  const random = Math.floor(Math.random() * 
                            (files.length - 1))
  const randomNote = files[random]
    
  tR += `- [[ ${randomNote.path} | ${ randomNote.basename } ]]\n`
}
%>

I’ve also included the option to specify how many random notes you want by changing the first line to whatever number of random notes you want.