To extract a random number between two numbers in JavaScript

Asked 2 years ago, Updated 2 years ago, 148 views

For example, random (1,6); I want to take any number between 1, 2, 3, 4, 5, 6 Is it possible with JavaScript?

javascript random

2022-09-22 22:07

1 Answers

Math.floor(Math.random() * 6) + 1 Do it like this


2022-09-22 22:07

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.