# [R] quasi-random sequences

Robert A LaBudde ral at lcfltd.com
Sat Apr 26 17:02:10 CEST 2008

```You seem to have ambiguous requirements.

First, you want equidistribution for a packing
structure, which would suggest closest packing or
quasirandom sequences, as you have tried.

But then you are disturbed by the packing
structure, because it gives a perceivable
pattern, so you wish to randomize it, but under
some unspecified condition of equidistribution

You obviously have some constraints on selection
you have not quantified yet. E.g., circles of unspecified radii cannot overlap.

You should also realize that any distribution of
centers under such constraints will always
exhibit structure due to the constraints.

Is your problem simply to give an appearance of
randomness to the casual observer, or something more definite?

You also need to say something about the packing density involved.

On the face of it, you with
At 06:22 AM 4/26/2008, baptiste Auguié wrote:
>Dear list useRs,
>
>I have to generate a random set of coordinates (x,y) in [-1 ; 1]^2
>for say, N points. At each of these points is drawn a circle (later
>on, an ellipse) of random size, as in:
>
>
> > N <- 100
> >
> > positions <- matrix(rnorm(2 * N, mean = 0 , sd= 0.5), nrow=N)
> > sizes<-rnorm(N, mean = 0 , sd= 1)
> > plot(positions,type="p",cex=sizes)
>
>
>My problem is to avoid collisions (overlap, really) between the
>points. I would like some random pattern, but with a minimum
>exclusion distance. In looking up "Numerical recipes in C", I found
>out about some Sobol quasi-random sequences, which one can call from
>the gsl package,
>
>
> > library(gsl)
> >
> > g <- qrng_alloc(type="sobol",dim=2)
> > qrng_get(g,n= N) ->xy
> >
> > plot((xy),t="p",cex=0.5)
>
>but this does not look very random: I clearly see some pattern
>(diagonals, etc...), and even the non-overlapping condition is not
>impressive.
>
>One (painful) way I can foresee is to check the distance between each
>symbol and the others, and move the overlapping ones in a recursive
>manner. Before delving into this, I wanted to check I'm not
>overlooking something in the rgl quasi-random sequences, or missing a
>more obvious way to generate such patterns. Perhaps solving an
>electrostatic problem with a potential both attractive at long
>distances and repulsive at short distances is a better way? I have a
>vague recollection of hearing that somewhere to position points
>evenly on a sphere.
>
>
>Thanks for any comment / suggestion,
>
>Baptiste
>
>
>_____________________________
>
>Baptiste Auguié
>
>Physics Department
>University of Exeter
>Exeter, Devon,
>EX4 4QL, UK
>
>Phone: +44 1392 264187
>
>http://newton.ex.ac.uk/research/emag
>http://projects.ex.ac.uk/atto
>
>______________________________________________
>R-help at r-project.org mailing list
>https://stat.ethz.ch/mailman/listinfo/r-help
>and provide commented, minimal, self-contained, reproducible code.

================================================================
Robert A. LaBudde, PhD, PAS, Dpl. ACAFS  e-mail: ral at lcfltd.com
Least Cost Formulations, Ltd.            URL: http://lcfltd.com/
824 Timberlake Drive                     Tel: 757-467-0954
Virginia Beach, VA 23464-3239            Fax: 757-467-2947

"Vere scire est per causas scire"
================================================================

```