How can I make repeatable action untill I get a specific number.

So, actually I´m trying to get in how works coding. Somehow I want that my code, writes a number or whatever else(for example “1”), so it will trigger “=RANDBETWEEN(1,9)”, I want that it does until I get a specific list of numbers, for example I need 9 nines. I´m trying to do with “do… loop” but don´t really understand how it works.

I honestly think that no one understands what you are trying to ask.