#include    <time.h>
#include    <stdlib.h>
#include    <stdio.h>
#include    <math.h>

int main ( int argc, char *argv[] )
{

  int number_of_steps = 30;
  int repetition = 6500000;
  int distance = 0;
  int total_distance = 0;
  double expected_distance;
  int i, j;

  srand(time(NULL));

  for ( i = 0; i < repetition; i++ ) {

    for ( j = 0; j < number_of_steps; j++) {
      distance += rand() & 1 ? -1 : 1;
    }

    total_distance += distance * distance;
    distance = 0;

  }

  expected_distance = sqrt((float) total_distance / repetition);

  printf ( "%g\n", expected_distance );
  return EXIT_SUCCESS;
}       /* ----------  end of function main  ---------- */