GenService.cs 430 B

1234567891011121314151617
  1. namespace Alchemy.Core.Services
  2. {
  3. public class GenService
  4. {
  5. public static string GenNumberCode(int degit)
  6. {
  7. if (degit > 1)
  8. {
  9. Random random = new Random();
  10. string code = random.Next(10 ^ degit - 1, 10 ^ degit).ToString();
  11. return code.PadLeft(degit, '0');
  12. }
  13. else
  14. return "0";
  15. }
  16. }
  17. }