mardi 26 février 2019

randomly generate specific pattern 5 digit number with minimum and maximum 2 similar digits with javascript / node

I'm trying to find a way to generate 5 digit number with the specific pattern :

  • The digits can't be : 12345 or 54321
  • The digits should have at minimum and at maximum 2 occurrences exemple : 84262 is acceptable but 87249 is not.

I've been trying to use regex exec and math floor but i can't seem to find a solution.




Aucun commentaire:

Enregistrer un commentaire