This code does not produce output from the circular buffer
It only prints the content of the array.
`
int[] values = new int[20];
Random rnd = new Random();
for (int i = 0; i < values.Length; i++)
values[i] = rnd.Next(1, 99);
CircularBuffer buffer = new CircularBuffer(values.Length / 2);
This code does not produce output from the circular buffer It only prints the content of the array. ` int[] values = new int[20]; Random rnd = new Random();
for (int i = 0; i < values.Length; i++) values[i] = rnd.Next(1, 99);
CircularBuffer buffer = new CircularBuffer(values.Length / 2);
Console.WriteLine(string.Join(", ", values));
foreach (int value in values) buffer.Add(value);
Console.WriteLine(string.Join(", ", buffer));
Console.ReadKey(); `
I think there might be an issue with this method
`private void innerInsert(T value) { _circularBuffer[_tail] = value; _tail = (_tail + 1) % _circularBuffer.Length; if (_tail == _head) // <- here { _head = (_head + 1) % _circularBuffer.Length; }