From ce2002c7c4530637664c4a7cab9239f95ea2bca3 Mon Sep 17 00:00:00 2001
From: Malin Freeborn <malinfreeborn@posteo.net>
Date: Sun, 21 Apr 2024 20:13:03 +0200
Subject: [PATCH] make randomize macro

---
 layout.sty | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/layout.sty b/layout.sty
index 82f0ffb0..10790b9f 100644
--- a/layout.sty
+++ b/layout.sty
@@ -980,6 +980,27 @@ interior code={ \path[tcb fill interior] ([xshift=-2mm]interior.west)
   \addtocounter{r12}{\value{r4}}%
 }
 
+\newcommand\randomize{%
+  \stepcounter{r2}%
+  \stepcounter{r3}%
+  \stepcounter{r4}%
+  \ifodd\value{r3}%
+    \stepcounter{r2b}%
+    \stepcounter{r3b}%
+    \stepcounter{r4}%
+  \else%
+    \stepcounter{r2c}%
+    \stepcounter{r3c}%
+    \stepcounter{r4b}%
+  \fi%
+  \foreach\c in {r2,r2b,r2c}%
+    {\ifnum\value{\c}>2\setcounter{\c}{1}\fi}%
+  \foreach\c in {r3,r3b,r3c}%
+    {\ifnum\value{\c}>3\setcounter{\c}{1}\fi}%
+  \foreach\c in {r4,r4b}%
+    {\ifnum\value{\c}>4\setcounter{\c}{1}\fi}%
+}
+
 %%%%%%%%%%%%%%%%%%%% LAYOUT %%%%%%%%%%%%%%%%%%%%
 \makeindex
 
-- 
GitLab