我在试着编程,很简单的取随机数,可就这样也不对,我不知道哪里错了,编译时没问题,而且在Eclipse环境下运行JSimpleBug的例程也没出错,可为什么我这个简单的试验程序却出错了呢?帮帮忙吧。在Eclipse环境下。4 ^! M N. F# t2 W" |
import swarm.Globals;
7 f( x1 L p" i$ J4 l
& I3 s8 [+ A" hpublic class test {
# t ~6 @* n8 X /**
9 m" {) m$ u2 S# f* D j * @param args8 \! [7 k$ z; H/ T4 U
*// P y) t" }& c! U
public static void main(String[] args) {( }2 h/ h/ } E; u( B( N: t3 c% {
; Q' k( L1 }/ ]# G0 U+ H+ b int y=(int)(10*Math.random());' w+ O, w( C" Y6 ^; \* E
System.out.println("result is "+y);# c* F% }3 l: u. k2 ?" I
* {% B2 L6 N' I; a% z/ e$ f: e5 A
double z=Globals.env.uniformDblRand.getDoubleWithMin$withMax(0.0, 1.0);+ f& Y- G2 l# Y8 g" k9 y+ q. d
System.out.print(z+" re");
( r' T9 B& @& T8 P# I/ R2 }. w }
+ p. n/ t! M9 @) V. [. A; |+ e}
: R% R7 e$ }7 X7 V$ Z4 r7 d1 `5 U4 z6 Q
结果是:
; I. c$ Y! ]) M iresult is 2
+ B, `5 M* U5 ?8 f; k9 ~" Y; ?) f& u5 h% z#* g a- }" B4 n9 y% p
# An unexpected error has been detected by Java Runtime Environment:
4 D! n( h& K9 [ N8 R: U3 ?, d2 h#3 @" y' Q# s! H
# EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x100b8305, pid=1064, tid=1068) Y. t1 |, Z0 l8 ]1 t7 X
#
; f3 B. B( P3 F F. e+ p# Java VM: Java HotSpot(TM) Client VM (1.6.0_01-b06 mixed mode, sharing)2 I, I* F2 R) S# k& O. L
# Problematic frame:; e, Q: q' O% j( Q- C& R: b
# C [javaswarm.dll+0xb8305]
. h2 [( f) n7 w& s#
1 C! s* C5 k A7 Y" V& V5 m+ D6 e6 Q) b# An error report file with more information is saved as hs_err_pid1064.log |