anchor.diff:  stddev_values( #stream_stddev{ mean = Mean } = X )  ->
       { Mean, math:sqrt( stddev_variance(X) ) }.
   
  +    
  +stddev_samples( #stream_stddev{ n = N } ) -> N.
  +
   
   %%%%% ------------------------------------------------------- %%%%%
  +
  +
  +-spec sample_new( pos_integer() ) -> #stream_sample{}.
  +
  +sample_new(N) ->
  +    #stream_sample{ size = N }.
  +    
  +
  +sample_update( X
  +             , #stream_sample{ size = N
  +                             , count = Cnt
  +                             , data = Data } = State)
  +        when Cnt < N  ->
  +    State#stream_sample{ count = Cnt + 1
  +                       , data = erlang:append_element(Data, X) };
  +                       
  +                       
  +sample_update( X
  +             , #stream_sample{ size = N
  +                             , count = Cnt
  +                             , data = Data } = State) ->
  +    R = rand:uniform(Cnt + 1),
  +    NewData =   case R =< N of
  +                    true    -> erlang:setelement(R, Data, X)
  +                ;   false   -> Data
  +                end,
  +    State#stream_sample{ count = Cnt + 1
  +                       , data = NewData }.
  +
  +                       
  +sample_values( #stream_sample{ data = Data } ) ->                       
  +    erlang:tuple_to_list(Data).
  +
  +                       
  +%%%%% ------------------------------------------------------- %%%%%
  +
  
positive.code:     , mean      = 0.0       :: float()
      , m2        = 0.0       :: float()
      , delta     = 0.0       :: float()
      }).
  
  
  
negative.code: 
  -module(stream).
  
  -export([stddev_new/0, stddev_push/2, stddev_variance/1, stddev_values/1, stddev_samples/1]).
  -export([sample_new/1, sample_update/2, sample_values/1]).
  
  
  %%%%% ------------------------------------------------------- %%%%%
  