forked from kovacsrud/frontend_13
Véletlen számok
This commit is contained in:
24
js_valtozok/veletlenszam.js
Normal file
24
js_valtozok/veletlenszam.js
Normal file
@@ -0,0 +1,24 @@
|
||||
|
||||
let veletlen=Math.random();
|
||||
|
||||
console.log(veletlen);
|
||||
|
||||
//Egész szám megadott határok között
|
||||
|
||||
veletlen=Math.random()*10;
|
||||
|
||||
console.log(veletlen);
|
||||
|
||||
veletlen=Math.floor(Math.random()*10)+1;
|
||||
|
||||
console.log(veletlen);
|
||||
|
||||
veletlen=Math.floor(Math.random()*(100-10))+10;
|
||||
|
||||
console.log(veletlen);
|
||||
|
||||
function veletlenSzam(min,max){
|
||||
return Math.floor(Math.random()*(max-min))+min;
|
||||
}
|
||||
|
||||
console.log(veletlenSzam(5,25));
|
||||
Reference in New Issue
Block a user