55import picocli .CommandLine .ParentCommand ;
66
77import java .nio .charset .StandardCharsets ;
8- import java .time .Instant ;
98import java .util .Random ;
109import java .util .concurrent .Callable ;
1110
@@ -36,11 +35,12 @@ public class LegendCommand implements Callable<Integer> {
3635 @ ParentCommand
3736 Object parent ; // optional: access parent config if needed later
3837
38+ public static final String LINE = "─────────────────────────────" ;
3939 private static final String [][] STORY_EN = new String [][]{
4040 {
41- "─────────────────────────────" ,
41+ LINE ,
4242 " Dochia’s Legend" ,
43- "─────────────────────────────" ,
43+ LINE ,
4444 "Baba Dochia climbed the mountain," ,
4545 "wearing nine coats, one on top of another." ,
4646 "She thought spring had come," ,
@@ -53,10 +53,10 @@ public class LegendCommand implements Callable<Integer> {
5353 "Never trust the weather forecast," ,
5454 "and always test your edge cases. 😉" ,
5555 "" ,
56- "─────────────────────────────" ,
56+ LINE ,
5757 "Tip: Run `dochia --chaos` to shed" ,
5858 "some coats of your own." ,
59- "─────────────────────────────"
59+ LINE
6060 }
6161 };
6262
@@ -93,16 +93,12 @@ private Variant chooseVariant() {
9393 if (ascii ) return Variant .ASCII ;
9494
9595 // Random choice for the easter egg when no explicit style is set
96- Random rnd = (seed != null ) ? new Random (seed ) : seededRandom ();
96+ Random rnd = (seed != null ) ? new Random (seed ) : new Random ();
9797 int pick = rnd .nextInt (3 );
98- return pick == 0 ? Variant .STORY : (pick == 1 ? Variant .HAIKU : Variant .ASCII );
99- }
100-
101- private Random seededRandom () {
102- // Derive a seed from current time, PID hash & some bytes to keep variety but reproducible per run
103- long t = Instant .now ().toEpochMilli ();
104- long mix = t ^ System .identityHashCode (this );
105- return new Random (mix );
98+ if (pick == 0 ) {
99+ return Variant .STORY ;
100+ }
101+ return pick == 1 ? Variant .HAIKU : Variant .ASCII ;
106102 }
107103
108104 private String [][] resolveLines (Variant v ) {
@@ -114,7 +110,7 @@ private String[][] resolveLines(Variant v) {
114110 }
115111
116112 private void printBoxed (String [][] content , boolean ansi ) {
117- final String top = repeat ("─" , Math .max ( 20 , Math . min ( 120 , width ) ));
113+ final String top = repeat ("─" , Math .clamp ( width , 20 , 120 ));
118114 // Only add colored title bars for STORY; keep HAIKU/ASCII clean
119115 boolean banner = content [0 ].length > 8 ; // crude but effective
120116
0 commit comments