n=10000;
a=Table[0,{n}];
Dynamic[
Do[
j=RandomInteger[{1,n}];
jm=j-1/. 0 -> n;
jp = j+1 /. n+1->1;
a[[j]]=Max[a[[jm]],a[[j]]+1,a[[jp]]],
{n}
];
ListPlot@a
]

n=10000;
b=Table[0,{n}];
Do[
++b[[RandomInteger[{1,n}]]],
{100n}
];
ListPlot@b