C# compare random number to int -


How do I compare a randomly generated number to an int?

  random i = new random (); Stable Ent Generator Castle (Random I) {Return i.Next (7); } Father's Castle (i); If (i.Equals (0)) MessageBox.Show (vincitore + "Vince!", "GG Easy"); Otherwise if (i.Equals (1)) {{Messagebox.Show (vincitore + "bara ..", "GG Easy"); } And if (i.Equals (2)) {Messagebox.Show (perdente + "sei rincoglionito?", "GG EASY"); }   

.Equals do not work, while "==" gives me a compilation error

  if (convert. Double (j) == 0) // does not work much    

i Do you want to be system.Random as usual and never compare a number of i.Next calls value ?

In your code, generaCasuale returns an int, but you are not using that return value; You are calling the method without telling anything. If you type int x = generaCasuale (i); , you can compare x .

Comments

Popular posts from this blog

java - ImportError: No module named py4j.java_gateway -

python - Receiving "KeyError" after decoding json result from url -

.net - Creating a new Queue Manager and Queue in Websphere MQ (using C#) -