Skip to main content
added 164 characters in body
Source Link
Jakque
  • 2.7k
  • 7
  • 13

Also 18 bytes

`q‛:Ė+:{h~/$₴Ḣ℅`:Ė

Try it Online!

Also 18 bytes

`q‛:Ė+:{h~/$₴Ḣ℅`:Ė

Try it Online!

added 32 characters in body
Source Link
Jakque
  • 2.7k
  • 7
  • 13
`              `D  # push this string to the stack and triplicate => [ <code> , <code> , <code> ]
                 Ė # Execute the top => [ <code>, <code> ]
 {                 # While true
  Ȯ                # push the second to last item on the stack => [ <code> , <code> , <code> ]
   q‛DĖ+           # quote and add ‛DĖ => [ <code> , <code> , `<code>`DĖ ]
        $          # swap => [ <code> , `<code>`DĖ , <code> ]
         /Ḣ        # split and discard the first element => [ <code> , [`DĖ] ]
           ℅h      # choose at random an element and get it's first element => [ <code> , ` ]
             :₴    # duplicate and print without a newline => [ <code> , ` ]
## on loop ##
 {                 # While true
  Ȯ                # push the second to last item on the stack => [ <code> , ` , <code> ]
   q‛DĖ+           # quote and add ‛DĖ => [ <code> , ` , `<code>`DĖ ]
        $          # swap => [ <code> , `<code>`DĖ , ` ]
         /Ḣ        # split and discard the first element => [ <code> , [<code>, DĖ] ]
           ℅h      # choose at random an element and get it's first element (or error and stop the program) => [ <code> , <char> ]
             :₴    # duplicate and print without a newline => [ <code> , <char> ]
`              `D  # push this string to the stack and triplicate => [ <code> , <code> , <code> ]
                 Ė # Execute the top => [ <code>, <code> ]
 {                 # While true
  Ȯ                # push the second to last item on the stack => [ <code> , <code> , <code> ]
   q‛DĖ+           # quote and add ‛DĖ => [ <code> , <code> , `<code>`DĖ ]
        $          # swap => [ <code> , `<code>`DĖ , <code> ]
         /Ḣ        # split and discard the first element => [ <code> , [`DĖ] ]
           ℅h      # choose at random an element and get it's first element => [ <code> , ` ]
             :₴    # duplicate and print without a newline => [ <code> , ` ]
## on loop ##
 {                 # While true
  Ȯ                # push the second to last item on the stack => [ <code> , ` , <code> ]
   q‛DĖ+           # quote and add ‛DĖ => [ <code> , ` , `<code>`DĖ ]
        $          # swap => [ <code> , `<code>`DĖ , ` ]
         /Ḣ        # split and discard the first element => [ <code> , [<code>, DĖ] ]
           ℅h      # choose at random an element and get it's first element => [ <code> , <char> ]
             :₴    # duplicate and print without a newline => [ <code> , <char> ]
`              `D  # push this string to the stack and triplicate => [ <code> , <code> , <code> ]
                 Ė # Execute the top => [ <code>, <code> ]
 {                 # While true
  Ȯ                # push the second to last item on the stack => [ <code> , <code> , <code> ]
   q‛DĖ+           # quote and add ‛DĖ => [ <code> , <code> , `<code>`DĖ ]
        $          # swap => [ <code> , `<code>`DĖ , <code> ]
         /Ḣ        # split and discard the first element => [ <code> , [`DĖ] ]
           ℅h      # choose at random an element and get it's first element => [ <code> , ` ]
             :₴    # duplicate and print without a newline => [ <code> , ` ]
## on loop ##
 {                 # While true
  Ȯ                # push the second to last item on the stack => [ <code> , ` , <code> ]
   q‛DĖ+           # quote and add ‛DĖ => [ <code> , ` , `<code>`DĖ ]
        $          # swap => [ <code> , `<code>`DĖ , ` ]
         /Ḣ        # split and discard the first element => [ <code> , [<code>, DĖ] ]
           ℅h      # choose at random an element and get it's first element (or error and stop the program) => [ <code> , <char> ]
             :₴    # duplicate and print without a newline => [ <code> , <char> ]
Source Link
Jakque
  • 2.7k
  • 7
  • 13

Vyxal D, 18 bytes

`{Ȯq‛DĖ+$/Ḣ℅h:₴`DĖ

Try it Online!

Sample outputs:

`{Ȯq‛DĖ
`DĖ
`{Ȯq‛DĖ+$/Ḣ℅h:₴`{Ȯq‛DĖ
`DĖ+$/Ḣ℅h:₴`{Ȯq‛DĖ+$/Ḣ℅h:₴`DĖ+$/Ḣ℅h:₴`{Ȯq‛DĖ+$/Ḣ℅h:₴`DĖ
`DĖ+$/Ḣ℅h:₴`{Ȯq‛DĖ

Explanation:

`              `D  # push this string to the stack and triplicate => [ <code> , <code> , <code> ]
                 Ė # Execute the top => [ <code>, <code> ]
 {                 # While true
  Ȯ                # push the second to last item on the stack => [ <code> , <code> , <code> ]
   q‛DĖ+           # quote and add ‛DĖ => [ <code> , <code> , `<code>`DĖ ]
        $          # swap => [ <code> , `<code>`DĖ , <code> ]
         /Ḣ        # split and discard the first element => [ <code> , [`DĖ] ]
           ℅h      # choose at random an element and get it's first element => [ <code> , ` ]
             :₴    # duplicate and print without a newline => [ <code> , ` ]
## on loop ##
 {                 # While true
  Ȯ                # push the second to last item on the stack => [ <code> , ` , <code> ]
   q‛DĖ+           # quote and add ‛DĖ => [ <code> , ` , `<code>`DĖ ]
        $          # swap => [ <code> , `<code>`DĖ , ` ]
         /Ḣ        # split and discard the first element => [ <code> , [<code>, DĖ] ]
           ℅h      # choose at random an element and get it's first element => [ <code> , <char> ]
             :₴    # duplicate and print without a newline => [ <code> , <char> ]