Answer by Rasoul-Ghadimi for Generating random numbers that keep a minimum...
I face a similar problem in my calculation and I want to share my answer here.The following argument is related to two-dimension, but it can also generalize to other dimensions,lets first make random...
View ArticleAnswer by heropup for Generating random numbers that keep a minimum distance
Easiest solution is as follows: for a required minimum distance $d$ such that $|x_i - x_j| \ge d$ for all $1 \le i \ne j \le n$, select $y_1 < \ldots < y_n$ from $\{1, \ldots, m - (n-1)(d-1)\}$...
View ArticleAnswer by kglr for Generating random numbers that keep a minimum distance
Construct a random sample from Range[m] satisfying the minimumdistance requirements taking into account the fact that if $x_k$ isselected at step $k$, the choices in step $k+1$ are restricted tothe...
View ArticleAnswer by MelaGo for Generating random numbers that keep a minimum distance
How about something like this - rather than picking random numbers until one satisfies the minimum distance criteria, pick the random number from a set that excludes disallowed values.gen2[m_, n_,...
View ArticleGenerating random numbers that keep a minimum distance
I want to create a list of n random integers from 1 to m, where all integers have to be at least a certain distance min apart (i.e. 3 integers out of Range[10], keeping a minimum distance of 2) This is...
View Article