Zig 0.17.0-dev (Split by item)

This is an example of documentation generated by ZigDoc, an alternative to Zig's built-in Auto Doc feature. See also examples in other modes/formats. The project being documented here (as the example) is the Zig library itself.

generatePattern

Helper: Generate pattern data where data[i] = (i % 251)

kangarootwelve.generatePattern
fn generatePattern(allocator: Allocator, len: usize) ![]u8

File

lib/std/crypto/kangarootwelve.zig:1565

Code

fn generatePattern(allocator: Allocator, len: usize) ![]u8 {
    const data = try allocator.alloc(u8, len);
    for (data, 0..) |*byte, i| {
        byte.* = @intCast(i % 251);
    }
    return data;
}