Random Generator | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Random Generator

I want to build a random generator for a role playing game to cut down on the amount of dice rolls necessary. I want it to be web-based so others can use it. Obviously, I will need html and css for style, but should I focus on learning JavaScript or is there another language that would be more appropriate to create the generator code?

10th Apr 2018, 2:11 AM
Chris Low
Chris Low - avatar
3 Answers
+ 2
Hi Chris You only need a very simple Javascript function like this function randomRange(min, max) { return (Math.random() * (max - min)) + min; } and call it like this var diceRoll=randomRange(10,100);
10th Apr 2018, 9:32 AM
Mike Choy
Mike Choy - avatar
+ 1
You have to learn javascript for any sort of web development. So you can start with learning Javascript without any worries.
10th Apr 2018, 3:05 AM
Akib
Akib - avatar
+ 1
Thank you both!
10th Apr 2018, 10:30 AM
Chris Low
Chris Low - avatar