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

Php operator `break` doesn't stop while -

ubuntu - Bash Script to Check That Files Are Being Created -

vim: Search & replace -