Newsgroups: comp.lang.python
From: Andriy Kornatskyy <andriy.kornats...@live.com>
Date: Sat, 3 Nov 2012 11:42:38 +0300
Local: Sat, Nov 3 2012 4:42 am
Subject: RE: How to generate account number?
Steven, see below, please.
----------------------------------------
> From: steve+comp.lang.pyt...@pearwood.info
Yes. There are consequences to not use sequential numbers, yet humans deal with it (enter as input somewhere, etc). The approach suggested here:
> Subject: Re: How to generate account number? > Date: Fri, 2 Nov 2012 22:39:31 +0000 > To: python-l...@python.org > On Sat, 03 Nov 2012 00:13:19 +0300, Andriy Kornatskyy wrote:
>> Requirements for `account number` generator:
>> 1. Issue pseudo random consistent number (must be unique for dozen
> How much randomness do you need? From the perspective of any one user, a
> last_num = 103872 # Pick an arbitrary starting value.
> Stick that value in a database instead of a global, and you're done.
> What are the consequences of people guessing account numbers? If the
http://mindref.blogspot.com/2012/11/generate-account-number.html
is using Feistel cipher to generate pseudo random thus makes guessing account numbers hard (impossible?).
>> 2. Easy check validity (without a need to make a database call)
These tell me how to verify some code, but doesn't how to generate it. The approach suggested here:
> Add a check digit to the number you generate. There are all sorts of ways
> http://code.activestate.com/recipes/577692
http://mindref.blogspot.com/2012/11/generate-account-number.html
gives you ability to customize `sample_f` function to make it unique to your business case.
>> Interested? Read more here:
The question was rhetorical with my answer in the blog and discussion here to reach something.
> If you ask a question here, please keep the discussion here, don't split
> Tell us your requirements in more detail, and we will try to help you.
I have presented solution to `account number` challenge. So it was share with community and seek for thoughts if any.
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
| ||||||||||||||