All pastes #2051401 Raw Edit

Miscellany

public text v1 · immutable
#2051401 ·published 2011-04-28 01:59 UTC
rendered paste body
static Stack<int> RandStack (int size)
{
    if (size < 1)
        throw new ArgumentException("Value of stacks parameter cannot be less than 1.", "value");

    Stack<int> mystack = new Stack<int>(size);
    Random rand = new Random();
    for (int i = 0; i < size; i++)
    {
        mystack.Push(rand.Next(0, 99));
    }
    return mystack;
}