dlang-book/book/04-массивы-ассоциативные-массивы-и-строки/src/chapter-4-2/app.d

29 lines
478 B
D

import std.stdio, std.random;
void main()
{
int[128] someInts;
int[3] a;
assert(a == [0, 0, 0]);
int[3] b = [1, 2, 3];
assert(b == [1, 2, 3]);
int[4] c = -1;
assert(c == [-1, -1, -1, -1]);
int[1024] d = void;
double[10] array;
foreach (i; 0 .. array.length)
{
array[i] = uniform(0.0, 1.0);
}
writeln(array);
foreach (ref element; array)
{
element = uniform(0.0, 1.0);
}
writeln(array);
}