我在试着编程,很简单的取随机数,可就这样也不对,我不知道哪里错了,编译时没问题,而且在Eclipse环境下运行JSimpleBug的例程也没出错,可为什么我这个简单的试验程序却出错了呢?帮帮忙吧。在Eclipse环境下。) j, M8 M: t/ P) s. d
import swarm.Globals;" M* w$ ^$ F6 _2 E9 m/ [' }
. t/ ^5 ~. f* |; _public class test {& ~1 S0 a2 A i: Q5 Z0 @7 o2 e
/**
3 z$ h2 x1 E" k8 Y * @param args- V+ X+ t4 x( I! W% b! g% n
*/
& `: m a4 R6 w( O public static void main(String[] args) {
: b" K0 N2 k9 k" e, X ! x+ g1 @( M& O- y- n! A
int y=(int)(10*Math.random());
4 I; s/ f! t+ Q System.out.println("result is "+y);' Q7 i# g8 i9 Q* J w" y
/ I8 v: n& {6 A8 Y
double z=Globals.env.uniformDblRand.getDoubleWithMin$withMax(0.0, 1.0);
/ l# Q1 W: ~2 i System.out.print(z+" re");
1 j# X2 P" G: B% L" C }1 B) J4 e$ n' v5 C0 `6 g! H6 Z% `: d, C
}
" Q8 ~& x% w) F; W$ E7 ]6 u0 a- P2 N. w& P8 T8 p8 y( _( {4 {- ^! r/ L
结果是:5 k, z* H; ~. R# ^8 A: M0 L
result is 2
3 L4 l* ?/ F, Z" H) F# _8 K% {( d5 c3 k2 f
# An unexpected error has been detected by Java Runtime Environment:) c, X$ y7 t/ t: q5 _
#5 G$ N7 P/ T+ B
# EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x100b8305, pid=1064, tid=1068, d' D7 C$ K s0 W K- i) P6 d
#
# J$ h4 q: j2 b1 E, B# Java VM: Java HotSpot(TM) Client VM (1.6.0_01-b06 mixed mode, sharing)3 h! G+ \2 i! H
# Problematic frame:' P# V" P8 a/ ?5 h- M# `: |
# C [javaswarm.dll+0xb8305]
! l* O2 @; d2 {0 }#% ~, _) ~+ W, k
# An error report file with more information is saved as hs_err_pid1064.log |