Search/highlight a random line of text?
So, say I have a text file (that can be edited) with the following:
Line 1
Line 2
Line 3
I would add a "random' button on the tool. It would pick a random line from 1 - 3, and highlight it.
If I were to add on to the list like so:
Line 1
Line 2
Line 3
Line 4
Line 5
Line 6
I would want to pick a random line from 1 - 6, and highlight it.
I also would like to have the option where if it detects a space in between each new line, to NOT register it, like so:
Line 1
Line 2
Line 3
Line 4
To skip to another line if there is no text written there, but still select a random line and highlight it.
What would I need to do to go about this? Do I need variables to detect the # of lines, or a construction of code to read certain text?