By the following I'm trying to generate a list of random coordinates (ex. 4) each within unit distance from previous one, starting from origin. What am I doing wrong?
o = {0, 0, 0};
RP = Module[{},
RN = RandomReal[1000, 3];
RV1 = RN/(2*RootMeanSquare[RN]);
o = RV1 + o;
RV2 = {};
RV2 = Append[RV2, o]
]
In[231]:= Do[RP, {i, 1, 4}]
RV2
Module
is essentially useless and you should be using:=
instead of=
, you resetRV
each time andDo
does not work like you might be assuming. Please read up on the help tutorials and e.g. this thread What are the most common pitfalls awaiting new users? $\endgroup$