Difference between revisions of "Add"
(Created page with "Generates a new random number, converts it to it's corresponding Unicode/ASCII (not sure which encoding format) character and then appends it to the end of the queue. Note if...") |
|||
Line 1: | Line 1: | ||
+ | <syntaxhighlight lang=csharp> | ||
+ | public void Add() | ||
+ | { | ||
+ | int RandNo = 0; | ||
+ | if (Rear < MaxSize - 1) | ||
+ | { | ||
+ | RandNo = Rnd.Next(0, 26); | ||
+ | Rear++; | ||
+ | Contents[Rear] = Convert.ToChar(65 + RandNo).ToString(); | ||
+ | } | ||
+ | } | ||
+ | </syntaxhighlight> | ||
+ | |||
Generates a new random number, converts it to it's corresponding Unicode/ASCII (not sure which encoding format) character and then appends it to the end of the queue. Note if the queue is full then then this method essentially does nothing. | Generates a new random number, converts it to it's corresponding Unicode/ASCII (not sure which encoding format) character and then appends it to the end of the queue. Note if the queue is full then then this method essentially does nothing. |
Revision as of 12:44, 14 November 2017
public void Add()
{
int RandNo = 0;
if (Rear < MaxSize - 1)
{
RandNo = Rnd.Next(0, 26);
Rear++;
Contents[Rear] = Convert.ToChar(65 + RandNo).ToString();
}
}
Generates a new random number, converts it to it's corresponding Unicode/ASCII (not sure which encoding format) character and then appends it to the end of the queue. Note if the queue is full then then this method essentially does nothing.