Voittorivi.cs 795 Bytes
Newer Older
M1888's avatar
M1888 committed
1 2 3 4 5
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
M1888's avatar
M1888 committed
6
using Medallion; // thread-safe staattinen Rand
M1888's avatar
M1888 committed
7 8 9 10 11 12

namespace Lottokone.Model
{
    public class Voittorivi : Rivi
    {
        public short Lisanumero { get; set; }
M1888's avatar
M1888 committed
13

M1888's avatar
M1888 committed
14 15 16 17 18 19
        public Voittorivi()
        {
            Numerot = new short[7];
            ArvoRivi();
        }

M1888's avatar
M1888 committed
20 21 22
        public override void ArvoRivi()
        {
            base.ArvoRivi();
M1888's avatar
M1888 committed
23 24 25 26 27 28 29 30 31 32

            // arvotaan voittoriville vielä lisänumero
            do {
                Lisanumero = (short)Rand.Next(0, 41);
            } while (Numerot.Contains(Lisanumero));
        }

        public override string ToString()
        {
            return base.ToString() + $" + [ {Lisanumero} ]";
M1888's avatar
M1888 committed
33
        }
M1888's avatar
M1888 committed
34 35
    }
}