有关生成难以追查发票编号的想法 [英] Ideas about Generating Untraceable Invoice IDs

查看:96
本文介绍了有关生成难以追查发票编号的想法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要打印发票的客户在我的应用程序。每张发票都有一个发票ID 即可。我想要的ID是:

I want to print invoices for customers in my app. Each invoice has an Invoice ID. I want IDs to be:


  • 顺序(最近进入IDS来晚了)

  • 32位整数

  • 不容易可追踪像1 2 3,使人们不能告诉我们有多少个项目卖。

  • Sequential (ids entered lately come late)
  • 32 bit integers
  • Not easily traceable like 1 2 3 so that people can't tell how many items we sell.

我自己的想法:
因为一个特定的日期和放大器;时间(例如1/1/2010 7:00 AM)。

An idea of my own: Number of seconds since a specific date & time (e.g. 1/1/2010 00 AM).

任何其他的想法如何产生这些数字?

Any other ideas how to generate these numbers ?

推荐答案

我不喜欢使用时间的想法。你可以碰到各种各样的问题 - 时间的差异,几个事件在一个单一的第二等发生

I don't like the idea of using time. You can run into all sorts of issues - time differences, several events happening in a single second and so on.

如果你想要的东西的顺序,而不是容易跟踪,怎么样产生1,你希望(如100),每个新的ID之间的任何一个随机数。每一个新的ID将是以前的号+随机数。

If you want something sequential and not easily traceable, how about generating a random number between 1 and whatever you wish (for example 100) for each new Id. Each new Id will be the previous Id + the random number.

您还可以添加一个常数你的ID,以使它们看起来更令人印象深刻。例如,您可以添加44323到所有的ID,把ID的15,23和27为44338,44346和44350。

You can also add a constant to your IDs to make them look more impressive. For example you can add 44323 to all your IDs and turn IDs 15, 23 and 27 into 44338, 44346 and 44350.

这篇关于有关生成难以追查发票编号的想法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆