我在试着编程,很简单的取随机数,可就这样也不对,我不知道哪里错了,编译时没问题,而且在Eclipse环境下运行JSimpleBug的例程也没出错,可为什么我这个简单的试验程序却出错了呢?帮帮忙吧。在Eclipse环境下。. @$ e( u O }8 u) ^% \
import swarm.Globals;% A8 R4 G$ t) Y+ g% N* S( [7 M
P7 ^& N2 t/ X+ L! b
public class test {
. \, \: j* @9 d+ b' d. M: Y /**
1 N0 W! Y! f- K% s" c# d. g7 S * @param args: G6 [* P/ d8 x r7 ?9 q9 G1 ]
*/2 p5 I/ L8 D+ k H$ h
public static void main(String[] args) {
- I4 }! m. G* T: p, d # d) [. x( j% `- \& e
int y=(int)(10*Math.random());
% K8 @6 }* T& y, M System.out.println("result is "+y);
! P9 B+ ~! n" ^3 O) {; i
; B; g2 l# P. K double z=Globals.env.uniformDblRand.getDoubleWithMin$withMax(0.0, 1.0);$ }/ s! n7 f o* q
System.out.print(z+" re");! C; @8 x! ~3 J( C8 G) s
}9 Q: X3 H2 z1 h# M
}
, v Q- S9 ~. u3 [2 X; ~: f6 q, @- q8 q5 T
结果是:
3 F% ^5 X$ r, f6 Z* a$ dresult is 2& S5 `+ w9 H7 ? {
#7 G. r* q# k/ q, N$ B4 w
# An unexpected error has been detected by Java Runtime Environment:/ Q+ l/ O& u9 I; O; y- _' o
#
- \, x. b# n8 j0 D# EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x100b8305, pid=1064, tid=1068
8 H |6 r7 ]9 {1 k( f0 m$ t#
& @: F/ _$ M+ z) |$ M# Java VM: Java HotSpot(TM) Client VM (1.6.0_01-b06 mixed mode, sharing)+ g9 s7 j; W9 [
# Problematic frame:3 H2 ?1 @# l: D7 N
# C [javaswarm.dll+0xb8305]
8 t6 Y$ _' Q! r6 q: {! b$ ]#
- R8 r9 C3 c- K3 f7 p# An error report file with more information is saved as hs_err_pid1064.log |