The online racing simulator
.NET - InSim.NET - InSim library
(731 posts, started )
Quote from Popughini :I looked it up but it didn't work for me and I thought they could help me here since I haven't been using visual studio for a long time.

Here's a very simple solution to generate your number.
This has nothing to do with the library, its just general C#.

int r = new Random().Next(1, 10);

if (r < 5) { // do something }

It's better if you make a thread where you ask basic questions of the InSim you downloaded somewhere. This is not relevant to this library.
Quote from Bose321 :It's better if you make a thread where you ask basic questions of the InSim you downloaded somewhere. This is not relevant to this library.

Sorry I got the code wrong, it was this code.

https://pastebin.com/6HSgNDtD

I need to add a random time on the green light
How do you expect us to magically know what you want here? Can't you ask the person where you downloaded this from?

Also, this code is bad in so many ways... Thread.Sleep is also really bad practice.
You've got "Thread.Sleep(1000);" on line 54, which is the one second pause between yellow and green - I don't know about the lang/framework you're using (edit: or best practices for it as Bose says), but that 1000 just needs to be a random integer between 1000 and say 5000 for a random 1 - 5 second delay.

.NET - InSim.NET - InSim library
(731 posts, started )
FGED GREDG RDFGDR GSFDG