Support Forums

Full Version: [C#] How to be a leet haxr [Makes a weird image?]
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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.
thanks.


this is random, and cool Big Grin
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.
(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.