Question: Sequences

I want to plot a graph of the following sequence

x[n]=p*x[n-1]+q*x[n-2] where x[0]=0 and x[1]=1. Also p & q are independ random variables with values +1 or -1.

This is what i've done so far

> with(Statistics):
> x[0]:=0: x[1]:= 1:
> for n from 2 to 10 do
> S:=Sample(Bernoulli(0.5),2):
> p:=S[1]: q:=S[2]:
> x[n]:=p*x[k-1]+q*x[k-2]: od;

But the output is not tallying up the x[n]'s. Also i just realised my code selects +1 or 0 for p & q......!

Please Wait...