Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[C#] How to be a leet haxr [Makes a weird image?]
#1
Has to be a console application.

Imports:
Code:
using System.Threading;

Code:
Code:
static void Main(string[] args)
        {
            Console.ForegroundColor = ConsoleColor.Green;
            while (1 != 2) // Obviously 1 doesn't equal 2. Bad Loop.
            {
                Random integer = new Random();
                Console.Write(Convert.ToString(integer.Next(0, 2)));
                Thread.Sleep(8); // Otherwise it repeats itself. Plus slow typing = cool 8-)
            }
        }

Usage: Just replace the Main void with the code above.

P.S. It sometimes makes funky images.
Reply
#2
thanks.


this is random, and cool Big Grin
Reply
#3
That's pretty cool except I'd suggest creating a new thread for the loop, you've put the sleep in the main thread which will freeze the program and not the loop.
Reply
#4
(09-02-2010, 08:00 PM)xHtmlPhP Wrote: That's pretty cool except I'd suggest creating a new thread for the loop, you've put the sleep in the main thread which will freeze the program and not the loop.

Threading is pointless when you're not doing anything productive. It will not freeze the program because it's a console application, if you don't stop the thread at time it'll keep going on as "0000000000000" instead of added 1's.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)