1
$\begingroup$

For example,how to randomly generate 100 points in line L:y=x,and x~N(0,1).

Edit:I mean,for point p(x,y),x=t,y=t,t is random variable,and t~N(0,1).Randomly generate 100 points like it.

New contributor
眠之龍 is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
$\endgroup$
0

3 Answers 3

3
$\begingroup$

Maybe

{#, #} & /@ RandomVariate[NormalDistribution[0, 1], 100]
% // Point // Graphics

enter image description here

$\endgroup$
5
$\begingroup$
Clear["Global`*"]

line = Line[{{-3, -3}, {3, 3}}];

SeedRandom[1234];

For uniformly distributed points on the line

ptsU = RandomPoint[line, 1000];

For normally distributed points on the line

ptsN = RandomVariate[TruncatedDistribution[{-3, 3},
     NormalDistribution[]], 1000];

Histogram[{ptsN, ptsU[[All, 1]]}, Automatic, "PDF"]

enter image description here

$\endgroup$
0
$\begingroup$

Or

Graphics[
 Table[Point[{tmp = RandomVariate[NormalDistribution[0, 1]], 
    tmp}], {100}]]
$\endgroup$

Your Answer

眠之龍 is a new contributor. Be nice, and check out our Code of Conduct.

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.