我在试着编程,很简单的取随机数,可就这样也不对,我不知道哪里错了,编译时没问题,而且在Eclipse环境下运行JSimpleBug的例程也没出错,可为什么我这个简单的试验程序却出错了呢?帮帮忙吧。在Eclipse环境下。
7 T. v- Z* i, }+ X; w- X. wimport swarm.Globals;
! l# m, l7 A; x2 \4 ?0 l* |, h" C5 E1 ^# B
public class test {! G, j1 Q4 j d1 j9 k# o
/**
+ j5 s3 {0 l4 g0 _ * @param args2 D+ d- }- _/ X& n) A
*/, y$ q, L u3 X# c7 i Y( ~
public static void main(String[] args) {( O7 j, q4 M$ u9 t7 ~9 @
# {2 q. G3 x3 D' K1 q! M3 J. }
int y=(int)(10*Math.random());
; ]! j: I2 ]+ ]# }9 f ?6 Q4 c System.out.println("result is "+y);
+ U; I2 F* R+ ]& c0 l5 R* E
) s* {4 V4 j2 v3 F5 X! I$ q double z=Globals.env.uniformDblRand.getDoubleWithMin$withMax(0.0, 1.0);
- N- q& |4 [9 m, d' B* q( T; h3 ?5 n System.out.print(z+" re");
# |. O0 y" Y9 f2 a1 f+ P$ C. [- S" s }
% T% Y% J' }% `6 K3 U, n}" b- Y% c( F8 _4 Q9 R+ |7 }" Q7 C, N
" ^8 x5 J" G9 z# A0 `
结果是:
; r. H& R6 D6 o4 H7 b% C8 j ^4 Mresult is 2
+ N* O7 R) u, i, \#
- d# h2 J @ B( o/ m7 O' t# An unexpected error has been detected by Java Runtime Environment:
$ b9 Y t: m: s* r, p. d5 o#
; P& G) t6 T4 [8 S7 H- E; D# EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x100b8305, pid=1064, tid=1068
6 P; e) U4 k+ g L9 s#; z! R# W2 O S' U, D3 j
# Java VM: Java HotSpot(TM) Client VM (1.6.0_01-b06 mixed mode, sharing) Y0 o) b3 `& { P- p9 ? a/ X
# Problematic frame:0 O/ p a* ~2 b# D
# C [javaswarm.dll+0xb8305]
# i# D+ w0 G% U3 T$ }#6 J3 } ^3 @$ Z8 s4 c% a
# An error report file with more information is saved as hs_err_pid1064.log |