我在试着编程,很简单的取随机数,可就这样也不对,我不知道哪里错了,编译时没问题,而且在Eclipse环境下运行JSimpleBug的例程也没出错,可为什么我这个简单的试验程序却出错了呢?帮帮忙吧。在Eclipse环境下。
; }' ^/ E' [! n* Wimport swarm.Globals;7 b7 M5 j. o5 _6 w; X2 ^8 a
- P; v% R8 ?, Gpublic class test {; Z c5 x( d! T# R
/**. N% a! X `, }4 G- `% m: k+ Z5 U
* @param args* x: c8 X" M- y) g `- |9 D! E
*/
& U& U. X+ e( t+ k7 F' f% w- v public static void main(String[] args) {
: e3 G. d; z1 O2 M: o' c/ j! b$ E $ A3 \ V0 G8 A5 G$ c' b! Y' f
int y=(int)(10*Math.random());* y8 e& \( b% Q5 _7 O
System.out.println("result is "+y);
5 |& ~* ^' Q, I8 y9 g1 w0 R! e# o0 y2 p0 X5 h) ~5 o, |
double z=Globals.env.uniformDblRand.getDoubleWithMin$withMax(0.0, 1.0);3 [* g' ~# V2 ^9 j7 r' y
System.out.print(z+" re");
& \* S7 j0 ^% _4 p/ a! a }
4 k7 l/ ]# m3 b4 G" G0 K}
- _ N; _* K! [+ f L- {3 m# Y: g7 a) g3 W6 O( T# ]" h
结果是:' P% W2 A: r+ h s5 H" Q( N
result is 2
* X" q1 ?0 V! D8 {#
# G/ K& W$ z1 `( J: @4 i. @! ?( i# An unexpected error has been detected by Java Runtime Environment:
. e# l. C% U0 i& J& c8 k9 }! b#
+ [3 U$ s% Y" W# EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x100b8305, pid=1064, tid=10683 {! S! V, g3 l g8 Q. m9 Y- T
#
0 o8 ^! H+ o# k! G# Java VM: Java HotSpot(TM) Client VM (1.6.0_01-b06 mixed mode, sharing)' c9 ]0 t1 K2 e% r+ t
# Problematic frame:/ S" I7 V4 g; ^3 h' [0 L, D
# C [javaswarm.dll+0xb8305]0 \. d8 T5 e4 F- o: h0 z3 U
#& A/ h/ w6 Z% s2 [6 A9 M
# An error report file with more information is saved as hs_err_pid1064.log |