Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9023713
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T05:49:36+00:00 2026-06-16T05:49:36+00:00

I’m running the same code on two machines. One (windows 7 64) uses: java

  • 0

I’m running the same code on two machines. One (windows 7 64) uses:

java version "1.7.0"
java<TM> SE Runtime Environment <build 1.7.0-b147>
Java HotSpot<TM> 64-Bit Server VM <build 21.0-b17, mixed code>

and the other (linux 64) uses:

java version "1.6.0_10"
Java(TM) SE Runtime Environment (build 1.6.0_10-b33)
Java HotSpot(TM) 64-Bit Server VM (build 11.0-b15, mixed mode)

I’m getting different outputs. I think it’s the VM because I copied the .class files, ran those, and still got different outputs.
Can anyone tell what could cause this?

EDIT:

The code is at http://pastebin.com/5EmYFkYn

The output should vary in between runs, yet not as drastically as it is between those two machines.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T05:49:38+00:00Added an answer on June 16, 2026 at 5:49 am

    I get ~1.78 with Java 6 update 31 and ~3.8 with Java 7 update 7 on the same Linux box.

    However if I get the random seed with new Random(1) or some other number I get the same result. e.g. 1 always produces ~ 0.79 for the third number.

    Looking at the code for how the random seed is created, the code is completely different and I suspect the nextDouble() isn’t as random as it should be i.e. your values should vary more and it should matter so much how the seed was set.


    I get different results every time I run it on the same machine with the same version of Java. Most likely as there are random elements in the code.

    499470 0 3.7783771731449503 10000.355400975242 0.07565041858446288 42
    499430 0 3.8374792234448916 10001.384837656298 0.07684781955465791 53
    499604 0 3.868284648304009 10000.698947869778 0.07743242690681965 57
    499114 0 3.822480313596936 10001.023197561686 0.07659315164172079 46
    500030 0 3.8653339884104576 10000.112232176294 0.077302909223347 43
    

    Since it is different between runs on the same machine, I would expect them to be different on different machines, and different versions of Java as well.

    I would still seriously consider getting a newer version of Java than Java 7 “update nothing” or a version of Java 6 which is four years old.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a French site that I want to parse, but am running into
I have this code to decode numeric html entities to the UTF8 equivalent character.
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
We're building an app, our first using Rails 3, and we're having to build
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I've tracked down a weird MySQL problem to the two different ways I was
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
I have been unable to fix a problem with Java Unicode and encoding. The
I have thousands of HTML files to process using Groovy/Java and I need to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.