Monday 24 December 2018

Javascript random number between two digits

I want to generate a valid number between 200 and 450. Here is my snippet of code.



Math.floor(Math.random() * 450) + 200


Sometimetimes its 568 or any number not in the range i would want it to be. Can anybode give me a hint how to solve it please?

No comments:

Post a Comment

php - file_get_contents shows unexpected output while reading a file

I want to output an inline jpg image as a base64 encoded string, however when I do this : $contents = file_get_contents($filename); print &q...