<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> </head>
<body>
<script>
a = Math.floor(Math.random()*9+1); b = Math.floor(Math.random()*9+1); c = Math.floor(Math.random()*9+1); d = Math.floor(Math.random()*9+1); e = Math.floor(Math.random()*9+1);
x = Math.floor(Math.random()*5+1); y = Math.floor(Math.random()*5+1);
Olayı doğru anladıysam, rasgele 2 yıldız gizlemek için:
y = Math.floor(Math.random()*10+1);
olması lazım. C(5,2) = 10 olduğu için. Sonrasında da:
if (y==1){ document.write("**" + c,d,e); }
else if (y==2){ document.write("*" + b + "*",d,e); }
else if (y==3){ document.write("*" + b, c + "*",e); } else if (y==4){ document.write("*" + b, c, d + "*"); } else if (y==5 ){ document.write(a + "**" + d, e); } else if (y==6){ document.write(a + "*" + c + "*" + e); }
else if (y==7){ document.write(a + "*" + c, d + "*"); }
else if (y==8){ document.write(a, b + "**" + e); } else if (y==9){ document.write(a, b + "*" + d + "*"); } else if (y==10 ){ document.write(a, b, c + "**"); }
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<script>
a = Math.floor(Math.random()*9+1);
b = Math.floor(Math.random()*9+1);
c = Math.floor(Math.random()*9+1);
d = Math.floor(Math.random()*9+1);
e = Math.floor(Math.random()*9+1);
x = Math.floor(Math.random()*5+1);
y = Math.floor(Math.random()*5+1);
document.write("Şifrelenmiş basamak = "+y+","+x);
document.write("<br>");
document.write("üretilen sayı = "+a,b,c,d,e);
document.write("<br>");
document.write("şifrelenmiş hali = ")
if (y==1){
document.write("*"+b,c,d,e);
}
else if (y==2){
document.write(a+"*",c,d,e);
}
else if (y==3){
document.write(a,b+"*",d,e);
}
else if (y==4){
document.write(a,b,c+"*",e);
}
else if (y==5 ){
document.write(a,b,c,d+"*");
}
</script>
</body>
</html>
Arkadaşlar yardım ederminisiniz sadece bir yıldız gizleyebiliyorum, amacım 2 rastgele yıldız gizlemek.
DH forumlarında vakit geçirmekten keyif alıyor gibisin ancak giriş yapmadığını görüyoruz.
Üye Ol Şimdi DeğilÜye olduğunda özel mesaj gönderebilir, beğendiğin konuları favorilerine ekleyip takibe alabilir ve daha önce gezdiğin konulara hızlıca erişebilirsin.
< Bu mesaj bu kişi tarafından değiştirildi mucahitozcantr -- 16 Nisan 2019; 14:24:48 >