A good algorithm for generating an order number

前端 未结 10 1534
青春惊慌失措
青春惊慌失措 2021-01-31 06:27

As much as I like using GUIDs as the unique identifiers in my system, it is not very user-friendly for fields like an order number where a customer may have to repeat that to a

10条回答
  •  感情败类
    2021-01-31 06:53

    Maybe you could try generating some unique text using a markov chain - see here for an example implementation in Python. Maybe use sequential numbers (rather than random ones) to generate the chain, so that (hopefully) the each order number is unique.

    Just a warning, though - see here for what can possibly happen if you aren't careful with your settings.

提交回复
热议问题