Crazy 8s Code Golf

Python 2, 119 bytes

import random,string
def f(a,b):print`[random.choice(string.printable[10:95])for _ in`a`]`[2+a%8*b::5]or a;a<b<f(a+1,b)

Try it online!


Python 2, 126 bytes

Try it online!

import random,string
def f(a,b):
 while b/a:print[a,eval('random.choice(string.printable[10:-6])+'*len(`a`)+"''")][a%8<1];a+=1

Many thanks to Flp.Tkc and EasterlyIrk for all of their help!


zsh, 100 98 bytes

for i in {$1..$2};{((i%8))&&<<<$i||<<<`yes 'shuf -e {!..~}|grep "[^0-9]"|head -c1'|head -$#i|zsh`}

The two input arguments are passed as command line arguments, and the numbers are output on separate lines.

for i in {$1..$2};{   # loop through the range
((i%8))&&             # if the number is not divisible by 8 (i % 8 != 0),
<<<$i||               # output it
<<<`                  # otherwise, output the following:
yes '                 # using `yes' as a golfy loop
shuf -e {\!..\~}      # shuffle the range of printable ASCII (minus space)
|grep "[^0-9]"        # get rid of numbers
|head -c1'            # take the first character
|head -$#i            # obtain a string with that code repeated len(i) times... 
|zsh                  # ... and eval it
`}