ash,hush: fix $RANDOM in children being repeated

function                                             old     new   delta
next_random                                           46      68     +22
forkshell                                            248     263     +15
expand_vars_to_list                                 2118    2131     +13
run_pipe                                            1775    1782      +7
popstring                                            134     140      +6
builtin_umask                                        123     121      -2
ash_main                                            1356    1336     -20
get_local_var_value                                  125     104     -21
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 5/3 up/down: 63/-43)             Total: 20 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
diff --git a/shell/ash.c b/shell/ash.c
index cc26771..d81dbd3 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -4725,10 +4725,12 @@
 			freejob(jp);
 		ash_msg_and_raise_error("can't fork");
 	}
-	if (pid == 0)
+	if (pid == 0) {
+		CLEAR_RANDOM_T(&random_gen); /* or else $RANDOM repeats in child */
 		forkchild(jp, n, mode);
-	else
+	} else {
 		forkparent(jp, n, mode, pid);
+	}
 	return pid;
 }
 
@@ -10079,12 +10081,6 @@
 static void FAST_FUNC
 change_random(const char *value)
 {
-	/* Galois LFSR parameter */
-	/* Taps at 32 31 29 1: */
-	enum { MASK = 0x8000000b };
-	/* Another example - taps at 32 31 30 10: */
-	/* MASK = 0x00400007 */
-
 	uint32_t t;
 
 	if (value == NULL) {
@@ -13268,11 +13264,6 @@
 #endif
 	rootpid = getpid();
 
-#if ENABLE_ASH_RANDOM_SUPPORT
-	/* Can use monotonic_ns() for better randomness but for now it is
-	 * not used anywhere else in busybox... so avoid bloat */
-	INIT_RANDOM_T(&random_gen, rootpid, monotonic_us());
-#endif
 	init();
 	setstackmark(&smark);
 	procargs(argv);