Show random text file from folder

I have a large folder of small notes (saved as .txt).

I would like to be able to click something and have the text from a randomly selected note within the folder display.

Maybe even have a random note show when I open a new browser tab.

Can anyone think how to achieve this?

Probably a few lines of Python code would do it.

Surprisingly easy with Apple Script (“some file”)

tell application "Finder" to open some file in the folder ¬
    (POSIX file "/Users/%you%/Desktop/musics")
1 Like