1234567891011121314151617181920212223242526272829 |
- 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);
- }
|