Constrained random points on a circle: Difference between revisions

m
(→‎{{header|Swift}}: + Standard ML)
Line 3,452:
 
=={{header|Standard ML}}==
Works with PolyML. Plotting function from 'Draw a pixel' task. Uniform random generator: copy from [[Random_numbers#Standard_ML]]. x,y plotted scaled x 10 px
<lang Standard ML>open XWindows ;
open Motif ;
Line 3,490:
val usum = fn (u,v) => u*(u-1.0) + v*(v-1.0) ;
val lim = ( ~350.0/900.0, ~225.0/900.0 ) ; (* limits to usum *)
val select = fn i as (x,y) => usum i <= #2 lim andalso usum i >= #1 lim ; (* select according to inequalities *)
val uv = ListPair.zip ( urandomlist (#1 realseeds) 2500 , urandomlist (#2 realseeds) 2500 ) (* draw 2500 couples *)
in
Anonymous user