Forked from: Murai's Math.random() * Number >> 0 diff:11 挙動の違い forked from: Math.random() * Number >> 0 @author Takashi Murai(KAYAC) bkzen forked:1favorite:0lines:29license : MIT License modified : 2009-11-20 21:34:02 Embed Tweet // forked from Murai's Math.random() * Number >> 0 // forked from Murai's 0 to .5 to 0 // forked from Murai's Math.random() - Math.random() package { import flash.display.*; import flash.text.*; /* @author Takashi Murai(KAYAC) */ [SWF(width="400", height="400", frameRate="24", backgroundColor="#FFFFFF")] public class Main extends Sprite { public var txt:TextField; public function Main() { init(); } public function init():void{ txt = new TextField(); txt.width = 400; txt.height = 400; addChild(txt); var i:uint=100, n: Number, a: int, b: int, c: int, d: int; while(--i){ n = Math.random()*5; a = n >> 0; b = Math.floor(n); n = -n; c = n >> 0; d = Math.floor(n); txt.appendText(a + " : " + b + " : "+ (a == b) + " : " + c + " : " + d + " : " + (c == d) + " : " + n + "\n" ); } } } } Code Fullscreen Preview Fullscreen Math.floor appendText height width TextField addChild Math.random uint Sprite Number int sort new page view favorite forked pv278 forked from: 挙動の違い forked from.. nemu90kWw forked:0 favorite:0lines:29 (diff:3)