我在试着编程,很简单的取随机数,可就这样也不对,我不知道哪里错了,编译时没问题,而且在Eclipse环境下运行JSimpleBug的例程也没出错,可为什么我这个简单的试验程序却出错了呢?帮帮忙吧。在Eclipse环境下。
3 n3 w8 @% M- vimport swarm.Globals;& g/ H* b# t) \
! ?8 G6 B8 J. ]: y5 q3 X* S
public class test {
4 ~$ p0 d, C: ~' Z5 w( [9 z# C /**1 u0 A& n1 }+ R$ x% o' Z- Z; |
* @param args
$ Q# n( a, c% G: X$ ?% E */
1 d- v* G$ t+ b public static void main(String[] args) {( S2 r8 H6 @3 r3 d% k! `; }* W+ G! g
5 b# N H+ g+ h6 X
int y=(int)(10*Math.random());2 W/ c! ~( L0 ]/ A
System.out.println("result is "+y);
& i. P# k$ F3 z7 A( W; W: b( ]' w5 ^" V
double z=Globals.env.uniformDblRand.getDoubleWithMin$withMax(0.0, 1.0);9 i* `$ e2 [' z# I& o* Y3 A7 w1 f0 P
System.out.print(z+" re");
8 P6 O2 ]* r! C9 ~$ i }) K4 b& j9 Z6 \7 [4 M) j ~5 [
}
. \0 q/ _8 Y% s) X
3 T1 l t i6 h4 x* U0 `# l+ k% @. L结果是:
' J* s- b8 y) v9 u' Hresult is 2
: B: Z) l' ]+ f6 B& _9 k#
/ X' Y7 @% e* W: l2 ]# G# An unexpected error has been detected by Java Runtime Environment:" `1 q" Z% L+ e# x$ W7 D
#
" k' P+ q" @1 I- Y) I9 B# EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x100b8305, pid=1064, tid=1068
$ ^$ ~# i6 Z3 j3 h, U* t#
1 \) Y1 d, H2 V! ]) Y% m( I! ~# Java VM: Java HotSpot(TM) Client VM (1.6.0_01-b06 mixed mode, sharing)
0 n- T. \* C* c& K# Problematic frame:# j1 g! j9 r* k. Y& N) h
# C [javaswarm.dll+0xb8305]
! H" x* S$ ~2 p/ x2 y; i#4 ]! Z0 H/ K& ]' c
# An error report file with more information is saved as hs_err_pid1064.log |