Task: Deal cards for FreeCell

C: #include <stdio.h>
#include <stdlib.h>
#include <locale.h>

wchar_t s_suits[] = L"♣♦♥♠", s_nums[] = L"A23456789TJQK";

#define RMAX32 ((1U << 31) - 1)
static int seed = 1;
int  rnd(void) { return (seed = (seed * 214013 + 2531011) & RMAX32) >> 16; }
void srnd(int x) { seed = x; }

void show(const int *c)
{
	int i;
	for (i = 0; i < 52; c++) {
		printf("  \033[%dm%lc\033[m%lc", 32 - (1 + *c) % 4 / 2,
			s_suits[*c % 4], s_nums[*c / 4]);
		if (!(++i % 8) || i == 52) putchar('\n');
	}
}

void deal(int s, int *t)
{
	int i, j;
	srnd(s);

	for (i = 0; i < 52; i++) t[i] = 51 - i;
	for (i = 0; i < 51; i++) {
		j = 51 - rnd() % (52 - i);
		s = t[i], t[i] = t[j], t[j] = s;
	}
}

int main(int c, char **v)
{
	int s, card[52];
	if (c < 2 || (s = atoi(v[1])) <= 0) s = 11982;

	setlocale(LC_ALL, "");

	deal(s, card);
	printf("Hand %d\n", s);
	show(card);

	return 0;
}



C#: using System;
using System.Collections.Generic;
using System.Text;

namespace FreeCellDeals
{
    public class RNG
    {
        private int _state;

        public RNG()
        {
            _state = (int)DateTime.Now.Ticks;
        }

        public RNG(int n)
        {
            _state = n;
        }
        public int Next()
        {
            return ((_state = 214013 * _state + 2531011) & int.MaxValue) >> 16;
        }
    }

    public enum Rank
    {
        Ace,
        One,
        Two,
        Three,
        Four,
        Five,
        Six,
        Seven,
        Eight,
        Nine,
        Ten,
        Jack,
        Queen,
        King
    }

    public enum Suit
    {
        Clubs,
        Diamonds,
        Hearts,
        Spades
    }

    public class Card
    {
        private const string Ranks = "A23456789TJQK";
        private const string Suits = "CDHS";

        private Rank _rank;
        public Rank Rank
        {
            get
            {
                return _rank;
            }
            set
            {
                if ((int)value < 0 || (int)value > 12)
                {
                    throw new InvalidOperationException("Setting card rank out of range");
                }
                _rank = value;
            }
        }

        private Suit _suit;
        public Suit Suit
        {
            get
            {
                return _suit;
            }
            set
            {
                if ((int)value < 0 || (int)value > 3)
                {
                    throw new InvalidOperationException("Setting card rank out of range");
                }
                _suit = value;
            }
        }

        public Card(Rank rank, Suit suit)
        {
            Rank = rank;
            Suit = suit;
        }

        public int NRank()
        {
            return (int) Rank;
        }

        public int NSuit()
        {
            return (int) Suit;
        }

        public override string ToString()
        {
            return new string(new[] {Ranks[NRank()], Suits[NSuit()]});
        }
    }

    public class FreeCellDeal
    {
        public List<Card> Deck { get; private set; }

        public FreeCellDeal(int iDeal)
        {
            RNG rng = new RNG(iDeal);

            List<Card> rDeck = new List<Card>();
            Deck = new List<Card>();

            for (int rank = 0; rank < 13; rank++)
            {
                for (int suit = 0; suit < 4; suit++)
                {
                    rDeck.Add(new Card((Rank)rank, (Suit)suit));
                }
            }

            
            
            for (int iCard = 51; iCard >= 0; iCard--)
            {
                int iSwap = rng.Next() % (iCard + 1);
                Deck.Add(rDeck[iSwap]);
                rDeck[iSwap] = rDeck[iCard];
            }
        }

        public override string ToString()
        {
            StringBuilder sb = new StringBuilder();
            for (int iRow = 0; iRow < 6; iRow++ )
            {
                for (int iCol = 0; iCol < 8; iCol++)
                {
                    sb.AppendFormat("{0} ", Deck[iRow * 8 + iCol]);
                }
                sb.Append("\n");
            }
            for (int iCard = 48; iCard < 52; iCard++)
            {
                sb.AppendFormat("{0} ", Deck[iCard]);
            }
            return sb.ToString();
        }
    }

    class Program
    {
        static void Main()
        {
            Console.WriteLine(new FreeCellDeal(1));
            Console.WriteLine();
            Console.WriteLine(new FreeCellDeal(617));
        }
    }
}