3
$\begingroup$
uniformm = UniformDistribution[{{-1, 1}, {-1, 1}}]; dist = PDF[uniformm, {x, y}]; Plot3D[dist, {x, -3, 3}, {y, -3, 3}, Filling -> Axis] c2 = Accumulate @ Prepend[RandomVariate[uniformm, {500, 2}], {0, 0}]; ListLinePlot[c2, AspectRatio -> Automatic] 

I am trying to plot a random walk drawn from a flat distribution. However, I keep getting x and y axes without a random walk graph.

$\endgroup$
1
  • 2
    $\begingroup$ RandomVariate[uniformm, {500, 2}] should read RandomVariate[uniformm, 500] $\endgroup$ Commented Jan 26, 2021 at 21:20

1 Answer 1

3
$\begingroup$
c2 = Accumulate @ Prepend[RandomVariate[uniformm, 500], {0, 0}]; ListLinePlot[c2, AspectRatio -> Automatic] 

enter image description here

$\endgroup$
1
  • 1
    $\begingroup$ compare RandomVariate[uniformm, 3] versus RandomVariate[uniformm, {3, 2}] to see why you need RandomVariate[uniformm,500] not RandomVariate[uniformm, {500,2}] $\endgroup$ Commented Jan 26, 2021 at 21:20

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.