Need Code to Randomly select Star Trek Series and Episode Number.
Hi.
Can someone make a command/script that can randomly generate one of these Star Trek series acronyms (tos, tng, ds9, voy, ent) and an episode from a corresponding number range? Example output: voy25 That being the 25th episode overall in the Voyager series. So if tos is selected then output a number from 1-79 (there were 79 episodes in The Original Series) For tng 1-178. (The Next Generation had the most episodes at 178) For ds9 1-176. For voy 1-172. For ent 1-98. Thanks. |
There are several ways to generate random permutations depending on how random you want to get. One easy way is using shuf.
series=$(shuf -n 1 -e tos tng ds9 voy ent) With a case or if statements you can generate an episode number based upon the series. episode=$(shuf -i 1-178 -n 1) output=$series$episode |
|
removed. beaten to it
|
Quote:
|
Quote:
|
Just because I am a Star Trek fan...
Code:
#!/bin/bash |
Quote:
|
Feel free to vote on the poll I just added. Cheers guys.
|
Quote:
|
khouji,
If this is a serious question please create a new thread. |
Quote:
https://docs.python.org/3/library/itertools.html (permutations and combinations) https://docs.python.org/3/library/random.html (note "shuffle" method) |
Here we have a poll about Star Trek and no one said one thing about Star Trek in 12 posts. Amazing.
I absolutely LOVED The Next Generation when it played originally, but every time I've watched a rerun I've been disgusted by the political correctness. Maybe I was just naive the first time around. |
The TOS is the only one to watch. It always had two parts to the shows. One was tech and other was some sort of literary conflict. They didn't go overboard on PC. It was the only tech show at the time.
|
TOS of course. TNG very, very close second. But I also think they did a pretty good job on DS9, Voyager and Enterprise. I like the whole of it. When you add all of these together and see the larger picture of the Federation, the universe its in, etc. its great.
Individually though TOS is the one. It all started there. |
All times are GMT -5. The time now is 09:29 PM. |