Speedy unsort:shuffle/1,2 ?

Björn-Egil Dahlberg egil@REDACTED
Wed May 26 14:41:19 CEST 2010


I while back there were some talk about an unsort or shuffle operation 
for lists. I too was in need of this since it very convenient in 
testing, so I wrote one.

However, there are some constraints on this function. It needs to be 
generic enough, it needs to be fast enough and consume as little memory 
as possible. Three constraints that seldom spell success when combined.

My suggestion is included in this mail, but my question is: does anyone 
have a faster, more generic and less memory consuming shuffle function?

My second concern is entropy. Does my function randomize the list 
enough? This approach will split the list continuously until it cannot 
be divided any further, then randomly deciding how it should be 
reassembled. This should be fast but does it give enough entropy? It is 
ok for my needs, I do not need it to be perfect.

Any comments?

Regards,
Björn-Egil
-------------- next part --------------
A non-text attachment was scrubbed...
Name: unsort.erl
Type: text/x-erlang
Size: 2458 bytes
Desc: not available
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20100526/d298bd4e/attachment.bin>


More information about the erlang-questions mailing list