Obscure / encrypt an order number as another number: symmetrical, “random” appearance?

后端 未结 7 507
长情又很酷
长情又很酷 2020-12-13 02:44

Client has an simple increasing order number (1, 2, 3...). He wants end-users to receive an 8- or 9- digit (digits only -- no characters) \"random\" number. Obviously, this

7条回答
  •  不思量自难忘°
    2020-12-13 02:59

    If your Order Id is unique, Simply you can make a prefix and add/mix that prefix with your order Id.

    Something like this:

    long pre = DateTime.Now.Ticks % 100;
    string prefix = pre.ToString();
    string number = prefix + YOURID.ToString()
    

提交回复
热议问题