Alice, 35 bytes
"d3a*h-&;adddd12h&}Uh*t&w.odt,k@
!
Explanation
"
Like in many quines in 2D languages, this starts with a " that wraps around to itself and pushes the entire first line except the " itself.
d3a*h-&;
Adding one or more additional copies of the source code will place some implicit spaces at the end of the string literal. To make this actually a quine, we truncate the stack at 31 characters.
addd
Push a newline, then the stack height three times. The values pushed as the stack height are 32 (the space in the second line), 33 (the ! in the second line), and 34 (the initial ").
d
Push the stack height again, this time as the length of the original source code (35).
1
Initialize a counter at 1. This will count the number of times the source code is repeated.
2h&}
Turn right three times in place (i.e., turn left). Each additional repetition of the source code will contribute an h in the same column as this }, thus incrementing the counter. When the IP returns to the }, turn right again to continue in the same direction.
Uh
Take a uniform random number from 0 to n-1, then add 1 to get the number of times to output the original source.
*t&w
Multiply by the previously pushed stack height (code length), then repeat the following that many times by pushing a return address that many times minus one.
.o
Output the top of the stack without destroying it.
dt,
Move the bottom stack entry to the top.
k@
Repeat, then terminate after the loop is finished.
- 10.8k
- 2
- 20
- 36