anchor.diff:      hd(lists:nthtail(M-1, In));
   random(In, Context) ->
       random(erlydtl_runtime:to_list(In, Context), Context).
  +
  +
  +%% @doc create a sublist of using n random elements from source list
  +random(N, _Count, _Context) when N == [] orelse N == undefined ->
  +    [];
  +random(In, Count, _Context) when is_list(In) ->
  +    L = length(In),
  +    RandomizedIn = z_utils:randomize(In),
  +    if
  +	Count >= L -> RandomizedIn;
  +	true	   -> lists:nthtail(L - Count, RandomizedIn)
  +    end;
  +random(In, Count, Context) ->
  +    random(erlydtl_runtime:to_list(In, Context), Count, Context).
  
positive.code: %% limitations under the License.
  
  -module(filter_random).
  -export([random/2]).
  
  
  random([], _Context) ->
      undefined;
  random(undefined, _Context) ->
  
negative.code: %% @author Marc Worrell <marc@worrell.nl>
  %% @copyright 2010 Marc Worrell
  %% @doc 'random' filter, return a random element/elements of a list
  
  %% Copyright 2010-2011 Marc Worrell, Konstantin Nikiforov
  %%
  %% Licensed under the Apache License, Version 2.0 (the "License");
  %% you may not use this file except in compliance with the License.
  