app.d 478 B

1234567891011121314151617181920212223242526272829
  1. import std.stdio, std.random;
  2. void main()
  3. {
  4. int[128] someInts;
  5. int[3] a;
  6. assert(a == [0, 0, 0]);
  7. int[3] b = [1, 2, 3];
  8. assert(b == [1, 2, 3]);
  9. int[4] c = -1;
  10. assert(c == [-1, -1, -1, -1]);
  11. int[1024] d = void;
  12. double[10] array;
  13. foreach (i; 0 .. array.length)
  14. {
  15. array[i] = uniform(0.0, 1.0);
  16. }
  17. writeln(array);
  18. foreach (ref element; array)
  19. {
  20. element = uniform(0.0, 1.0);
  21. }
  22. writeln(array);
  23. }