automate tuple creation
forkit
forkit at gmail.com
Fri Jan 21 21:47:36 UTC 2022
On Friday, 21 January 2022 at 21:43:38 UTC, forkit wrote:
>
oops... should be:
// ---
int[][int][] CreateDataSet
(const(int) recordsNeeded, const(int)valuesPerRecord)
{
int[][int][] records;
records.reserve(recordsNeeded);
const int iotaStartNum = 100_000_001;
foreach(i, id; iota(iotaStartNum, iotaStartNum +
recordsNeeded).enumerate)
{
records ~= [ id:
iota(valuesPerRecord).map!(valuesPerRecord =>
cast(int)rnd.dice(0.6, 1.4)).array ];
}
return records.dup;
}
// ---
More information about the Digitalmars-d-learn
mailing list