Re: How is Math.Random emulated? and how good is it?
Thanks, I'll try that other one and see if it helps. My Application/Doddle is here: http://www.darkflame.co.uk//Modoodler/Modoodler.html If anyone is interested. Hitting Run Commandsd on the default settings shows the bias. On Jan 11, 3:21 pm, Chi Hoang wrote: > java.lang.Math.random() calls the native javascript Math.random(). > > However, java.util.Random implements the random number algorithm > specified in the spec for that class - you can try using that if > java.lang.Math.random() is not random enough > > On Jan 11, 6:19 am, Kevin Jordan wrote: > > > > > > > > > All GWT's emulation does is natively call the javascript > > Math.random(). > > > On Jan 11, 3:02 am, darkflame wrote: > > > > I have been playing about drawing fractals in GWT using canvas and the > > > ¨ chaos game¨ method. > > > > However when picking large amounts of random numbers I seem to be > > > getting a bias. That is, the randomness doesn't seem evenly > > > distributed. > > > I have read many sources online that say that Javas normal > > > Math.Random() is flawed for this stuff, and some alternatives are > > > offered. However as GWTś Math.Random is merely an emulation, I > > > wondered if it suffered the same flaws or not. > > > Does anyone use alternative methods? > > > > This is all rather new too me, so if anyone has any pointers it would > > > be helpfull. -- You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to google-web-toolkit@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
Re: How is Math.Random emulated? and how good is it?
You can always look at the source... http://www.google.com/codesearch#A1edwVHBClQ/user/src/com/google/gwt/user/client/Random.java&q=random%20package:http://google-web-toolkit%5C.googlecode%5C.com so yes, it's the same On Jan 11, 8:07 pm, Kolban wrote: > I stumbled across this today ... > > http://google-web-toolkit.googlecode.com/svn/javadoc/latest/com/googl... > > It appears that there is also a Random class as part of the standard GWT > client environment. Is this the same as "Math.Random()?" > > Neil -- You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to google-web-toolkit@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
Re: How is Math.Random emulated? and how good is it?
I stumbled across this today ... http://google-web-toolkit.googlecode.com/svn/javadoc/latest/com/google/gwt/user/client/Random.html It appears that there is also a Random class as part of the standard GWT client environment. Is this the same as "Math.Random()?" Neil -- You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/7XS6Q9-_MiAJ. To post to this group, send email to google-web-toolkit@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
Re: How is Math.Random emulated? and how good is it?
http://code.google.com/p/google-web-toolkit/source/browse/trunk/user/super/com/google/gwt/emul/java/lang/Math.java public static native double random() /*-{ return Math.random(); }-*/; http://stackoverflow.com/questions/1062902/how-random-is-javascripts-math-random On Jan 11, 1:02 am, darkflame wrote: > I have been playing about drawing fractals in GWT using canvas and the > ¨ chaos game¨ method. > > However when picking large amounts of random numbers I seem to be > getting a bias. That is, the randomness doesn't seem evenly > distributed. > I have read many sources online that say that Javas normal > Math.Random() is flawed for this stuff, and some alternatives are > offered. However as GWTś Math.Random is merely an emulation, I > wondered if it suffered the same flaws or not. > Does anyone use alternative methods? > > This is all rather new too me, so if anyone has any pointers it would > be helpfull. -- You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to google-web-toolkit@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
Re: How is Math.Random emulated? and how good is it?
java.lang.Math.random() calls the native javascript Math.random(). However, java.util.Random implements the random number algorithm specified in the spec for that class - you can try using that if java.lang.Math.random() is not random enough On Jan 11, 6:19 am, Kevin Jordan wrote: > All GWT's emulation does is natively call the javascript > Math.random(). > > On Jan 11, 3:02 am, darkflame wrote: > > > > > > > > > I have been playing about drawing fractals in GWT using canvas and the > > ¨ chaos game¨ method. > > > However when picking large amounts of random numbers I seem to be > > getting a bias. That is, the randomness doesn't seem evenly > > distributed. > > I have read many sources online that say that Javas normal > > Math.Random() is flawed for this stuff, and some alternatives are > > offered. However as GWTś Math.Random is merely an emulation, I > > wondered if it suffered the same flaws or not. > > Does anyone use alternative methods? > > > This is all rather new too me, so if anyone has any pointers it would > > be helpfull. -- You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to google-web-toolkit@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
Re: How is Math.Random emulated? and how good is it?
All GWT's emulation does is natively call the javascript Math.random(). On Jan 11, 3:02 am, darkflame wrote: > I have been playing about drawing fractals in GWT using canvas and the > ¨ chaos game¨ method. > > However when picking large amounts of random numbers I seem to be > getting a bias. That is, the randomness doesn't seem evenly > distributed. > I have read many sources online that say that Javas normal > Math.Random() is flawed for this stuff, and some alternatives are > offered. However as GWTś Math.Random is merely an emulation, I > wondered if it suffered the same flaws or not. > Does anyone use alternative methods? > > This is all rather new too me, so if anyone has any pointers it would > be helpfull. -- You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to google-web-toolkit@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
How is Math.Random emulated? and how good is it?
I have been playing about drawing fractals in GWT using canvas and the ¨ chaos game¨ method. However when picking large amounts of random numbers I seem to be getting a bias. That is, the randomness doesn't seem evenly distributed. I have read many sources online that say that Javas normal Math.Random() is flawed for this stuff, and some alternatives are offered. However as GWTś Math.Random is merely an emulation, I wondered if it suffered the same flaws or not. Does anyone use alternative methods? This is all rather new too me, so if anyone has any pointers it would be helpfull. -- You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to google-web-toolkit@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.