pub fn rotate(comptime T: type, items: []T, amount: usize) void
In-place rotation of the values in an array ([0 1 2 3] becomes [1 2 3 0] if we rotate by 1) Assumes 0 <= amount <= items.len
T: type
items: []T
amount: usize
4078 4079 4080 4081 4082
pub fn rotate(comptime T: type, items: []T, amount: usize) void { reverse(T, items[0..amount]); reverse(T, items[amount..]); reverse(T, items); }
In-place rotation of the values in an array ([0 1 2 3] becomes [1 2 3 0] if we rotate by 1) Assumes 0 <= amount <= items.len