mirror of
https://github.com/dlang/phobos.git
synced 2025-04-28 14:10:30 +03:00
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:
commit
df741a928d
1 changed files with 4 additions and 16 deletions
|
@ -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)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue