Merge pull request #7014 from n8sh/rndstuffRndCleanup

Remove unnecessary check-and-initialize in std.alorithm.internal.rndstuff
merged-on-behalf-of: Nicholas Wilson <thewilsonator@users.noreply.github.com>
This commit is contained in:
The Dlang Bot 2019-05-18 07:49:35 +02:00 committed by GitHub
commit df741a928d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -21,15 +21,9 @@ version (unittest)
package string[] rndstuff(T : string)()
{
import std.random : Random = Xorshift, uniform;
import std.random : Xorshift, uniform;
static Random rnd;
static bool first = true;
if (first)
{
rnd.seed(234_567_891);
first = false;
}
static rnd = Xorshift(234_567_891);
string[] result =
new string[uniform(minArraySize, maxArraySize, rnd)];
string alpha = "abcdefghijABCDEFGHIJ";
@ -46,15 +40,9 @@ version (unittest)
package int[] rndstuff(T : int)()
{
import std.random : Random = Xorshift, uniform;
import std.random : Xorshift, uniform;
static Random rnd;
static bool first = true;
if (first)
{
rnd = Random(345_678_912);
first = false;
}
static rnd = Xorshift(345_678_912);
int[] result = new int[uniform(minArraySize, maxArraySize, rnd)];
foreach (ref i; result)
{