How can I create a password?

前端 未结 10 1752
悲&欢浪女
悲&欢浪女 2020-12-14 04:37

I want to give maybe a million password to some users that should be like:

  1. It must have at least 6 characters
  2. It must have digits and also letters
10条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-14 05:09

    This is also a nice one:

    String password = Integer.toString((int) (Math.random() * Integer.MAX_VALUE), 36);
    

    It however does not guarantee that the password always contains both digits and letters, but most of the aforementioned suggestions also doesn't do that.

提交回复
热议问题