Is the following a pure function? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Is the following a pure function?

function test(min,max) { return Math.random() * (max-min) + min; } My understanding is that a pure function follows these conditions: It returns a value computed from the parameters It doesn't do any work other than calculating the return value If this definition is correct, is my function a pure function? Or is my understanding of what defines a pure function incorrect?

5th Nov 2017, 1:09 PM
~Sudo Bash
~Sudo Bash - avatar
0 Answers