Make a Matrix Screen With Pseudo-Random Number Generator




About: I love writing computer programs and pulling stuff apart to "see how it works", then putting it back together again.

If you like the matrix, and have some spare time, you could make an endless program, that shows random numbers, as fast as the computer can run it, looking very similar to the matrix! It only takes about 5 minutes to prepare!

I was having a look around the Instructables site, and saw some Matrix screen makers.
I like writing computer programs, and one time decided to make one of these, and I am going to show you how!

You must have the Microsoft .NET Framework 3.5 installed to do this.

Please rate, it is my first instructable, and I want to know how I go.

If you do not have the Microsoft.NET Framework 3.5, you can easily download it from the Microsoft Download site (, and search for .NET 3.5.

I have made a new version that spits out random characters, instead of just numbers.

It DOES NOT show a screenshot of the matrix, or show a 3D screen. Just random letters. In green.


Step 1: Coding

You need to download the code file attached, and save it in to your my documents folder. If you are interested in computer programming, this program might be interesting to look at. You need to copy all of the italic text, and save it to a file called Program.txt.

using System; namespace Matrix_V2 { class Program { static void Main(string[] args) {
//Sets the text color to green
Console.ForegroundColor = ConsoleColor.Green;
//Create a string with some random characters
string random_characters = "£¤¥¦§¨©ª«¬®¯±²³´µ¶·¸¹ºΣΤΦΩαβδεμπστφABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz<,>.?/:;\"\'{[}]\\|`~0123456790-_=+!@#$%^&*() ";
//Get all of those characters and turn them into an "array"
char[] random_characters_array = random_characters.ToCharArray();
//Clear the screen Console.Clear();
//Writes details about the application to the console screen
Console.Title = "Matrix V2 - Press Ctrl+C to exit";
Console.WriteLine("Matrix V2");
Console.WriteLine("Written by Chris Ward");
Console.Write("Press any key to continue");
//Creates a pseudo-random generator
Random r = new Random();
//Creates a statement that runs forever
while (true) {
//Gets the ASCII character from the array, based on what the number is
//then runs the statement again... and again... etc.
} } } }

Step 2: Creating Batch File.

Open notepad again, and type this, only changing text if you know exactly what you are doing, and make sure it is all on one line, as I moved it on to separate lines so it would fit

 @C:\WINDOWS\Microsoft.NET\Framework\v3.5 \csc.exe /noconfig /nowarn:1701,1702
/errorreport:prompt /warn:4 /define:TRACE /reference:"C:\WINDOWS\Microsoft.NET\Framework
\v2.0.50727\System.dll" /filealign:512 /optimize- /target:exe /out:Matrix.EXE Program.txt

Then you must save it as a .BAT file, in the same location as the program.txt file.

Step 3: Running

Simply double click the batch file, and the command prompt window should close quickly. Once it has closed, the file should have been written (Matrix.EXE). Now all you have to do is run the program (Matrix.EXE), and the program will run.

If the file isn't created, add on a new line @pause to the batch file, then try running it again, then if there is detail on an error, post a comment and I will try to fix the problem. Any other problems? Just post a comment.

Step 4: Troubleshooting

 Error text: 'C:\WINDOWS\Microsoft.NET\Framework\v3.5'  is not recognized as an internal or external command, operable program or batch file'

* This is actually my fault, I made a mistake on the batch file. I will update the code on it, but to change it, there is a little space, just after the\v3.5 and before the \csc.exe. Just remove that space and run again. Alternatively you could download the code again

Any other problems? Post a message and I will get back to u asap.



    • Classroom Science Contest

      Classroom Science Contest
    • Fandom Contest

      Fandom Contest
    • IoT Challenge

      IoT Challenge

    49 Discussions


    8 years ago on Step 4

    I copied the code and removed the space before \csc.exe and it ran very nicely. thanx for the matrix code, much more realistic than simply using the random number code.


    9 years ago on Introduction

    so i have to have the frame work in order for this to work, and i really dont want just random as letters and numbers, does it look exactly like it in the picture?

    1 reply

    Reply 9 years ago on Introduction

    It doesnt look exactly like in the picture, what you are describing seems to be correct. I am currently working on a version that is more similar to the picture, but i cant make it in 3d, no idea how, lol. I will upload a new picture soon.


    4 years ago on Introduction

    My batch file won't change into a exe file. Is this because I have framework 4.5?


    Reply 7 years ago on Step 2

    Not sure what you mean by it's fast running, it's all about the speed of the computer. If anything you'd want to slow it down so it doesn't chew up too much CPU. And what do you mean error fixes? I didn't realise there were any errors. I pulled your source and can't find any error handling


    Reply 7 years ago on Step 2

    i meaned errors in maker(look up!):P Like spaces!
    I removed author data and "press enter" to start


    Reply 7 years ago on Step 2

    Well it is actually against the licence that the code is released under to remove that line and not attribute in any other form, just add a comment or something around the top saying it's derived from my source


    7 years ago on Introduction

    Can you tell me where is the place of the code "Press Ctrl+C to exit"? I want to change the combination key "Ctrl+C" to another key. Thank

    1 reply

    Reply 7 years ago on Introduction

    (Sorry for the late response) Ctrl+C is a standard key in Windows and other operating systems which simply kills the program where it is. In my code, I haven't actually got it listening for Ctrl+C, but I'm letting Windows kill the process when it is pressed. In short, Ctrl+C can't be changed without adding a lot more code.


    7 years ago on Step 3

    Please help
    it runs, closes just like its supposed to. but no file is created. HELPPPP

    3 replies

    Reply 7 years ago on Step 3

    Please read the troubleshooting section at the bottom of the Running page.


    Reply 7 years ago on Step 3

    @Tecnodancer, I put "@echo off" at the end, but still no .Exe file... Please help, I really want this to work. I've also tried deleting spaces, but i don't know witch ones to delete. What am I doing wrong?


    7 years ago on Step 4

    when i run it it just says
    The directory name is invalid.
    Press any key to continue . . .


    8 years ago on Step 4

    even know i removed the space, it did not make the Matrix.EXE file.

    1 reply

    Reply 8 years ago on Introduction

    Open the .bat file in notepad and add the line "@pause" to the end of the file on a new line. Run the bat again and post here what it says. Thanks