0

Well, like it says in the title I need to figure out how to choose a random file from a folder with no idea on where to start or what to look for. Anyone willing to help me out?

Hex
  • 25
  • 1
  • 3

1 Answers1

2

Get the list of files in the folder using lfs module, store them in a table, and get a random element from that table using t[math.random(#t)] expression.

Paul Kulchenko
  • 25,884
  • 3
  • 38
  • 56