Snippets tagged “math”
8 snippets use this tag.
- How do you round UP a number?Python
In Python, you can use the ceil() function from the math module to round a number up.
- How to Convert a Float Number to Whole Number in JavaScriptJavaScript
In this tutorial, you will read and learn detailed information about the methods used for converting a float number to a whole number with lots of examples.
- How to Find the Min/Max Elements in an Array in JavaScriptJavaScript
Read this JavaScript tutorial and learn about the methods used to find the minimum and maximum number of elements in an array. Find the fastest solution.
- How to Generate a Random Number Between Two Numbers in JavaScriptJavaScript
It is frequently necessary to generate a random number between two numbers while working with JavaScript. This snippet will help you to do it efficiently.
- How to Randomize (shuffle) a JavaScript ArrayJavaScript
In JavaScript, there no any built-in method of shuffling a JavaScript array. Read this tutorial and learn what is the popular method of randomizing arrays.
- Math.random() explanationJava
Math.random() is a method in the java.lang.Math class that returns a random double value between 0.0 (inclusive) and 1.0 (exclusive).
- round up to 2 decimal places in java?Java
To round a number up to two decimal places in Java, you can use the Math.ceil method and multiply the number by 100, then divide the result by 100.
- Way to get number of digits in an int?Java
To get the number of digits in an int in Java, you can use the log10() method of the Math class and then add 1 to the result.