There’s not enough information to really answer this properly, but if I were to guess:
You’re probably doing “new Random()” for each call to Newnum(), which means that time between each initialization is so short that they all get the same seed. This means that each call to Next() will always yield the same result.


Try initializing a Random object as a class field once, and then refer to the same instance each time Newnum() is called
This is probably the answer. You can create new Random() and pass it into the NewNum function, for instance. Also, the compiler may not care, but I would clean up those braces. It’s difficult to read your code with random braces, and you have an unnecessary set too. Your IDE should be able to format that for you.
Show us Newnum.
else if (money == 0)
static int Newnum(int min, int max) {Random random = new Random(); return random.Next(min, max);}
It looks like you already got an answer, which is to isolate the System.Random implementation outside of the loop as a property or private field. Now that you know that, please put your code on new lines and consider using Visual Studio. It will make things easier to read and write, I promise you. https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/inside-a-program/coding-conventions
I use Visual studio on my pc, but when Im not able to use a pc i use the one shown on my phone.
When/if I run into more problems I’ll wait with posting till I can use a proper program 🙂
So Im new with programing. Trying to make a slotsmachine as a way to practice.


But right now it seems to only generate one result at the start of the program and no new during later loops. Aswell as all 3 being the same.
any pointers or tips for what I should do?
Sorry about the format of the images. Im writing on a compiler ln my phone.
C# devs
null reference exceptions

source