roll *********************************** //Generating a random decimal number between 0 and 1 /* let x = Math.random(); console.log(x); */ //Generating a random number between 1 and 6(with a dice) but 0 and 5 technically /* let x = Math.random() * 6; console.log(x); */ //Generating a random number between 0 an 5 /* let x = Math.floor(Math.random() * 6); console.log(x); */ //Generating a random number between 1 and 6 /* let x = Math.floor(Math.random() * 6) + 1; console.log(x); */
Hmm I wanted to know how math.random() selects the number. In WoW /roll would give the dice roll for loot and casinos. I thought it was derived from the time frequency. CLA3 AI is describing itself with javaScript and math.random().
how to add the number just using one time math.floor. Suppose first time it gives 5 and next time it five 6 ...I want to add them by only using one time math.floor........how to store them and add them
what if I want it to have two input box where you can put the maximum and minimum that will generate 6 random numbers (EXAMPLE : Min: 1 Min:2 *press generate button Output: 2,1,3,5,7,6) please help🙂
As someone who currently follows the guide, most classes in the course work on the latest version. Currently at a 2 hour point of the whole thing but i couldn't do only one lesson, that being dictionaries.
@Dude, I am not an alien... If you're talking about javascript, try this out: function random() { let variable = Math.floor(Math.random() * 9) + 1; alert("Your random number is " + variable); } You can repeat this as much as you want to.
depends on the browser and the architecture, in most cases, you can't really tell... digging through the v8 engine source code i found a lot of different ways they create random numbers, so as far as i can see, you'll have to create your own seeded random function, a good starting point would be something called a "linear feedback shift register" and maybe some of your own implementations (just from the top of my head you could hash the seed you got, and interpret that as a value from 0 to 1)
let x;
let y;
let z;
document.getElementById("rollButton").onclick = function(){
x = Math.floor(Math.random() * 6) + 1;
y = Math.floor(Math.random() * 6) + 1;
z = Math.floor(Math.random() * 6) + 1;
document.getElementById("xlabel").innerHTML = x;
document.getElementById("ylabel").innerHTML = y;
document.getElementById("zlabel").innerHTML = z;
}
Document
roll
Thx
ily
Practicing...
Document
roll
***********************************
//Generating a random decimal number between 0 and 1
/*
let x = Math.random();
console.log(x);
*/
//Generating a random number between 1 and 6(with a dice) but 0 and 5 technically
/*
let x = Math.random() * 6;
console.log(x);
*/
//Generating a random number between 0 an 5
/*
let x = Math.floor(Math.random() * 6);
console.log(x);
*/
//Generating a random number between 1 and 6
/*
let x = Math.floor(Math.random() * 6) + 1;
console.log(x);
*/
At 0:26 to be precise Math.random() will output a value of >= 0 and less than (not equal) to 1
Ive learned more from you , than I ever did through my qualification courses.
can you make a complete playlist like this on react js, please this is my first day on your channel and you are really life saver
yes bro,
your way of explaining is top tier!
> discusses javascript
> elaborates
> doesn't leave you out
u r the best bro
This was really helpful, thank you.
4 min so good :D thanks for the info
great explanation of math.random()method
I think math.ceil()is wanted to use there because then we don't want to add 1
This was a great video, as it helped correct me in doing a similar task. Thank you!
Thx that was simple and helpful
"I like to play lot of D&D"... insta-subscribed 😅 Thanks so much for the JS tutorial!
Thank you!! 😄
Its really helped me, bro😃
You can just use Math.ceil(Math.random() * 6) instead
//For the algorithm!
Broskies are always there to help !!
thank you so much!! t's very helpful,
nice lecture
when he rolled 5 5 times in a row its a 1 in 7776 chance (thanks calculator)
amazing video
Hmm I wanted to know how math.random() selects the number.
In WoW /roll would give the dice roll for loot and casinos. I thought it was derived from the time frequency.
CLA3 AI is describing itself with javaScript and math.random().
Helpful tutorial. Thanks...
How can I add preset variables? Like 1-6 but the odds of getting 6 is more.
😂
im wondering that too, should probably search on google
probably roll something like 1 - 12 but then make it if it's bigger than 6 it will round to 6
Thanks > D
Thank you so much, Bro
how to add the number just using one time math.floor. Suppose first time it gives 5 and next time it five 6 ...I want to add them by only using one time math.floor........how to store them and add them
instead of pressing roll 10 times, is there a way to print to the screen with the data 10 times?
Yeah. Run a loop inside the function
Thanks!
what if I want it to have two input box where you can put the maximum and minimum that will generate 6 random numbers (EXAMPLE : Min: 1 Min:2 *press generate button Output: 2,1,3,5,7,6)
please help🙂
awesome, now every java game developers could make a gacha game and start milking their players' wallet
Thanks, Bro!
Hey Bro, thank you! =D
thank you
when you making plus 1 its random number between 1 and 7 and you didnt explain how to find numbers for example beteween 20 and 60
rand*(max-min) +min
i copied the exact same codes but its not working for me
Forex trading price is better than random() function
It Did Not Work :(
try again it will work
try copying his code to see if the problem is with your the code or with your IDE
Hi, i am looking for a code for generating unique username on registration form so pls advise.
can you make a video on python full course latest version
Um.. the 12 hour video on his channel is already latest version??
@@rayankhan12 that is 1 year old
As someone who currently follows the guide, most classes in the course work on the latest version. Currently at a 2 hour point of the whole thing but i couldn't do only one lesson, that being dictionaries.
@@Akgaming-games But it isn't easy to make another (more or less) 12 hour video on Python again.
@Dude, I am not an alien... If you're talking about javascript, try this out:
function random() {
let variable = Math.floor(Math.random() * 9) + 1;
alert("Your random number is " + variable);
}
You can repeat this as much as you want to.
thx for your help
Thats Brolicious!
What's the seed used here?
depends on the browser and the architecture, in most cases, you can't really tell...
digging through the v8 engine source code i found a lot of different ways they create random numbers, so as far as i can see, you'll have to create your own seeded random function, a good starting point would be something called a "linear feedback shift register" and maybe some of your own implementations (just from the top of my head you could hash the seed you got, and interpret that as a value from 0 to 1)
Can solve 6330 for Indonesian lottery
Let's freaking goooo 👻
Thx Bro!
I am already a bro😂😂
How would you put this in a discord bot?
Nice
you are the best
❤
Thx
Please do php
I am voting for PHP as well
thanks bro code!
👊🏽
Thank you!!😊