Java: 204 183 182 characters - 10 - 50 = 122
class K{public static void main(String[]y){int k,j,i=(int)(29*Math.random());for(j=0;j<30;j++,i+=Math.random()*28>=i?1:-1)for(k=0;k<31;k++)System.out.print(k>29?"\n":k==i?".":" ");}} First, the dot position must be 0 < x < 30, i.e. [1-29]. This generates a number between 0 and 28 uniformly distributed, and for the puroposes of this program [0-28] has the same effect as [1-29]:
i=(int)(29*Math.random()); I personally prefered if it would be normally distributed around 14, but my answer would be longer:
i=0;for(j=0;j<29;j++)i+=(int)(2*Math.random()); Second, this code ensures that it tends to be in the middle:
i+=Math.random()*28>=i?1:-1 The probability to get +1 is larger as smaller is the value of i, and we have the opposite for -1. If i is 0, the probability of getting +1 is 100%. If i is 28, the probability of getting +1 is 0%.
Third, by replacing the " " at the end by "_" to see the output easier, we see that each line has 30 characters plus a new line:
__________.___________________ _________.____________________ ________._____________________ _________.____________________ __________.___________________ ___________.__________________ __________.___________________ _________.____________________ ________._____________________ _________.____________________ ________._____________________ _________.____________________ __________.___________________ _________.____________________ __________.___________________ ___________.__________________ __________.___________________ _________.____________________ __________.___________________ ___________.__________________ ____________._________________ _____________.________________ ____________._________________ _____________.________________ ______________._______________ _____________.________________ ______________._______________ _______________.______________ ______________._______________ _____________.________________ Thanks for @VadimR for pointing out a misunderstanding in a prior version.