Generate Random number without repetiting the Number index

Hi all, i have quick doubt it will be helpful to resolve the issue. i need to generate random Number without repitative the Number in index - 6 digits.

is the request about unique random numbers with a length of 6 or
create all possible combinations of 6 digits length number without any repeated digit

Any set size limit or fully completed?

Hi ppr without repetative we need random number. like for example 123456 this is fine for our case. 122456 this is we don’t need.

Hi @Buvaneshwaran_R

New Random().Next(100000,999999).ToString this will generate a random number with 6 digits, but there is a possibility for digits repeating with in the 6 digits.

what you can do is,

use num = New Random().Next(0,9).ToString to generate 6 digits separately (u can use while loop) and check if there are any repeat numbers and join all the 6 digits if no repeated digits

if there is a repeat digit regenerate that digit and finally join it

hope this is helpful

μ§ˆλ¬Έμ— λ§žλŠ” μ†ŒμŠ€μΈμ§€ ν™•μΈν•΄λ³΄μ„Έμš”

μƒ˜ν”Œμ½”λ“œ_숫자_랜덀_비동일6자리.xaml (6.5 KB)

1 Like

thanks for answer
123456 OK
654321, 213456 will it be included as well into the set?
How much numbers do you want get generated? 10, 100 all possible combinations?

Thanks for your quick reply @peter. I got the solution now. Thanks for your response

κ³ λ§™μŠ΅λ‹ˆλ‹€ @sumouse

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.