# Good choices of PRNG for uniform circular (directional) data?

I'm planning to simulate iid one-dim variates with continuous uniform distribution on a normalized circle (which circumference is $1$ instead of $2\pi$). Namely, a sample consists of $n$ points simultaneously on the circle (so one may call it a random vector) where each point has an "angle" $X_i \in (0,1)$ for $i = 1\sim n$.

The project involves generating $N > 10^9$ samples for each of the following values of $n$: 5,6,7,8,9,10,11 and 100,101,102,103,104,105. The scope might expand depending on the outcomes.

The fundamental quantity of interest to me is the pairwise distance between the points (intrinsic distance along the circular arc).

For various reasons, Matlab is my current choice of platform, which default PRNG is the Mersenne Twister. I've encountered some opinions that Mersenne Twister, although widely used, is bad for statistical purposes unless tweaked very carefully (and that most people are doing it wrong). This is further elaborated in the Appendix.

Main Question:

Are there some good choices of PRNG specifically designed for circular data? I feel uncertain about "wrapping around" the usual $\mathrm{Unif}(0,1)$. It seems to me that the gap might be twice the "typical size" between the smallest number around 0 and the largest around 1.

To be more precise theoretically: the gap between adjacent order statistics of uniform $G_i \equiv U_{(i+1)} - U_{(i)}$ has a Beta distribution that is identical to the min $G_i \overset{d}{=} U_{(1)}$. Meanwhile, the ""wrap-around" gap $G_0 \equiv 1 + U_{(1)} - U_{(n)}$ is identically distributed as $G_0 \overset{d}{=} U_{(2)}$.

As for the aspect of implementation, I'm more than happy to code for combinations of PRNG from different families. Time cost is indeed a concern but not very important. If it's beneficial, I can switching from using Matlab to R.

I have read the article back in 2010 by David Jones and the 2015 paper by Agner Fog, both of which are informative while at the same time a good portion of the content are out of my grasp.

In particular, I'm not sure how or which part of the discussions apply to circular data (or not).

Secondary Question:

If the PRNG is good, can I just generate $N$ samples for a big $n_0$, say, $n_0 = 105$, and then resample (via permutation the ensemble that was "intended" for $n_0$) to obtain data for the smaller $n = 5,6,7,$ etc? Or is this actually not faster or mathematically unsound?

$$\color{white}. \\ \color{white}. \\ \color{white}.$$

## Appendix: Possible Issues with Mersenne Twister in Statistics

First there's the words from George Marsaglia (yes, one must cite him in a post about PRNG!)

"(the Mersenne Twister) ... essentially a lagged Fibonacci RNG using the exclusive-or (xor) operation, and experience has shown that lagged Fibonacci generators using xor provide unsatisfactory 'randomness'... and even with very long lags, many people (I among them) are inclined to be cautious about sequences based on such a simple operation as the xor ..."

The above is my excerpt from Marsaglia post in 1999 on Sci.Stat.Math, which is preserved in web.archive.org (please reload a few times if needed).

In the 2015 paper I mentioned above, when commenting about the (then) new version of MT in 2013 (for graphic processors no less), Agner Fog said:

"This generator has known weaknesses, which are common to the Mersenne Twister family: It is vulnerable to tests based on algebra $\mathbb{F}_{_2}$; it has relatively poor diffusion; and it has subsequences with more 0's than 1's."

These issues are echoed in some posts on StackOverflow and comments therein, like here in 2015 or this one in 2017.