JSFiddle - React, Tailwind, and code Playground
HTML
Iterations <input id=N value=100000>
Start (X Y) <input id=S value="300 100" >
R <input id=R value=0.5><br>
Points <input id=P value="300 100 100 450 500 450">
<button onclick="go()" >GO</button><br>
<canvas id=C></canvas>
CSS
input { width: 50px }
#P { width: 450px }
JavaScript
F=(n,sx,sy,r,p)=>
{
t=C.getContext("2d"),C.width=C.height=600
for(;n--;)
t.fillRect(sx,sy,1,1),
i=Math.random()*p.length&~1,
sx-=(sx-p[i])*r,
sy-=(sy-p[i+1])*r
}
function go()
{
var s=S.value.split(/ +/);
F(N.value, s[0],s[1], R.value, P.value.split(/[, ]+/))
}