Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
L

ljupcecar

@ljupcecar
About
Posts
1
Topics
0
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • just woundering about random numbers?
    L ljupcecar
    1. for random numbers

    static Random _r = new Random();
    static int F()
    {
    int n = _r.Next(0,36);
    return n;
    }

    1a) - if you want to make bingo card

    static void Main()
    {
    //if you want card with 6 numbers

            int\[\] numbers = new int\[6\];
    
    
        //to put different numbers at each place on the array
    
    
            for (int i = 0; i < numbers.Length; i++)
            {
                int a = F();
                bool has = numbers.Contains(a);
                if (has == true) {i--; }
                else {
                    numbers\[i\]=a;
                }
            }
    
    
        //to sort it and print it
    
            Array.Sort(numbers);
    
            int j = 0;
            foreach (int i in numbers)
            {
                Console.WriteLine("number at place " + (j+1).ToString() +" is " +i.ToString());
                j++;
            }
            Console.ReadLine();
    
    
    }
    
            static Random \_r = new Random();
            static int F()
            {
                int n = \_r.Next(0,36);
                return n;
            }
    

    for horses and chances of winning

    static void Main(string[] args)
    {
    int a = F();

    //if random number wich is between 1 and 100 is smaler or equal 80 than horse win
    if (a <= 80)
    {
        Console.Write("horse win!");
    }
    //else horse lose
    else { Console.Write("horse lose!"); }
    //and to check what is current value of number a - wich is number between 1 and 100
    Console.Write(" value of a is " + a.ToString());
    Console.ReadLine();
    

    }
    static Random _r = new Random();
    static int F()
    {
    int n = _r.Next(1, 100);
    return n;
    }

    C# question learning csharp game-dev tutorial
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups