C, 7186
Assuming that seeding the rand() function is not required.
k=30;main(i){i=rand()%k;while(k--){printf("%*c\n",i+=randi+=i==30?-1:i==1||rand()%2?1:-1,46);}} Explanation:
In C, in "%*c" the * means that the length of the output will have a minimum length, and this minimum length is determined by the argument of the function call (in this case, it is i+=i==30?-1:i==1||rand()%2?1:-1. The c means the next argument (46) is a character (the dot).
As for the boundary check, I apologise that I forgot about that. I have now added this to the answer, at the cost of 15 chars. The ternary operator works as follows: boolean_condition?value_if_true:value_if_false. Note that in C true is 1 and false is 0.