c# - How do I convert a double variable to an integer variable? -



c# - How do I convert a double variable to an integer variable? -

i need convert n integer. have tried h = rnd.next(0, math.floor(n)) while n stored double. code have in spot right below.

random rnd = new random(); k = rnd.next(50, 250); int n = math.floor(math.sqrt(300-k)); h = rnd.next(0, n);

math.floor returns double because method can homecoming special values such nan , infinity. need cast int: (int)math.floor(3.14).

c# int double

Comments

Popular posts from this blog

Delphi change the assembly code of a running process -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -

C++ 11 "class" keyword -