Pin Generation

前端 未结 11 820
走了就别回头了
走了就别回头了 2021-01-31 05:26

I am looking to develop a system in which i need to assign every user a unique pin code for security. The user will only enter this pin code as a means of identifying himself. T

11条回答
  •  孤城傲影
    2021-01-31 06:09

    If you use random number generator algorithms, so you never have PIN like "00038384882" , starts with 0 (zeros), because integer numbers never begins with "0". your PIN must be started with 1-9 numbers except 0.

    I have seen many PIN numbers include and begins many zeros, so you eliminate first million of numbers. Permutation need for calculations for how many numbers eliminated.

    I think you need put 0-9 numbers in a hash, and get by randomly from hash, and make your string PIN number.

提交回复
热议问题