This seems to be on its way: https://github.com/ziglang/zig/issues/20057
How would I do this in the meantime?
I am trying to return an array with random content of a given numeric type.
This is a "section of my function.
// `T` and `size` are inputs
const bytes = @sizeOf(T) * size;
const arr = try allocator.alloc(u8, bytes);
try std.posix.getrandom(arr);
return @ptrCast(arr); // return type is []u16