Unique 4 digit random number in C#

前端 未结 11 2089
故里飘歌
故里飘歌 2021-01-01 13:27

I want to generate an unique 4 digit random number. This is the below code what I have tried:

Code for generating random number

//Ge         


        
11条回答
  •  青春惊慌失措
    2021-01-01 14:01

    0 is the same as 0000.

    241 is the same as 0241.

    You could format the integer to a string with a leading zero.

提交回复
热议问题