|
| 1 | +package routes |
| 2 | + |
| 3 | +import "math/rand" |
| 4 | + |
| 5 | +func pangramGrep() (args []string, out string) { |
| 6 | + all := [][]string{ |
| 7 | + {"1", "A large fawn jumped quickly over white zinc boxes."}, |
| 8 | + {"1", "A wizard’s job is to vex chumps quickly in fog."}, |
| 9 | + {"1", "Bright vixens jump; dozy fowl quack."}, |
| 10 | + {"0", "Five or six big jet planes zoomed past the tower."}, |
| 11 | + {"1", "Fix problem quickly with galvanized jets."}, |
| 12 | + {"1", "Go, lazy fat vixen; be shrewd, jump quick."}, |
| 13 | + {"1", "Jumpy halfling dwarves pick quartz box."}, |
| 14 | + {"0", "My ex pub quiz crowd gave happy thanks."}, |
| 15 | + {"1", "Pack my box with five dozen liquor jugs."}, |
| 16 | + {"1", "The five boxing wizards jump quickly."}, |
| 17 | + {"1", "The jay, pig, fox, zebra and my wolves quack!"}, |
| 18 | + {"0", "The quick brown fox jumps over a lazy cat."}, |
| 19 | + {"1", "Waxy and quivering, jocks fumble the pizza."}, |
| 20 | + {"1", "When zombies arrive, quickly fax judge Pat."}, |
| 21 | + } |
| 22 | + |
| 23 | + // Shuffle the whole set. |
| 24 | + for i := range all { |
| 25 | + j := rand.Intn(i + 1) |
| 26 | + all[i], all[j] = all[j], all[i] |
| 27 | + } |
| 28 | + |
| 29 | + for _, v := range all { |
| 30 | + args = append(args, v[1]) |
| 31 | + |
| 32 | + if v[0] == "1" { |
| 33 | + out += v[1] + "\n" |
| 34 | + } |
| 35 | + } |
| 36 | + |
| 37 | + // Drop the trailing newline. |
| 38 | + out = out[:len(out)-1] |
| 39 | + |
| 40 | + return |
| 41 | +} |
0 commit comments