From: | Erik Jones <ejones(at)engineyard(dot)com> |
---|---|
To: | Craig Ringer <craig(at)postnewspapers(dot)com(dot)au> |
Cc: | Bill Moran <wmoran(at)potentialtech(dot)com>, Jasen Betts <jasen(at)xnet(dot)co(dot)nz>, pgsql-general(at)postgresql(dot)org |
Subject: | Re: Re: Mapping output from a SEQUENCE into something non-repeating/colliding but random-looking? |
Date: | 2009-05-03 01:07:08 |
Message-ID: | AB5B0C2A-4A20-48B8-9054-656878CB6E43@engineyard.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On May 1, 2009, at 6:06 AM, Craig Ringer wrote:
<snip>
> What I'm looking for is a function that, given an input within a
> constrained range (say, a 32 bit integer) produces a different output
> within the same range. For any given input, the output should be the
> same each time, and for any given output there should only be one
> input
> that results in that output.
I think you drop the idea of a repeatable mapping you may have some
success with the Knuth (aka Fisher-Yates) shuffle algorithm: http://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle
Why does anything need to be repeatable when you only need to make
sure that each number is only generated once?
Erik Jones, Database Administrator
Engine Yard
Support, Scalability, Reliability
866.518.9273 x 260
Location: US/Pacific
IRC: mage2k
From | Date | Subject | |
---|---|---|---|
Next Message | Jasen Betts | 2009-05-03 04:41:35 | Re: Mapping output from a SEQUENCE into something non-repeating/colliding but random-looking? |
Previous Message | Terry Lee Tucker | 2009-05-02 21:15:09 | Re: Two Questions Re: Warm Backup |