[erlang-patches] lists:shuffle

Björn Gustavsson <>
Wed Mar 31 16:43:52 CEST 2010


(Please keep the discussion on the mailing list. I have
added back a CC to the list.)

2010/3/31 William v Doorn <>:
> Hello,
>
> It's been implemented in the "standard" libaries of like every popular
> langauge. It basically shuffles the list. Here are two examples of
> implemenations:
>
> - Python: http://docs.python.org/library/random.html (Scroll down a bit)
> - Java:
> http://java.sun.com/j2se/1.4.2/docs/api/java/util/Collections.html#shuffle(java.util.List)
>

I think that we might consider adding a shuffle() function to the
'random' module.

Could you show us your Erlang implementation shuffle() function that you
considered too slow. Perhaps it can be optimized to be fast enough. We
will need a reference implementation anyway, because we will not add
any new BIFs before benchmarking them to see whether the performance
improvement is significant enough.

-- 
Björn Gustavsson, Erlang/OTP, Ericsson AB


More information about the erlang-patches mailing list