In python:
import random
i = 0
while True:
w = random.randint(1,6)
if w == 6:
break
elif w == 3:
i += 1
print(w)
print(f"3 was generated {i} times")
I don't exactly know how you want the output but you should be able to modify my code according to your needs. I hope this helps!