date: 2008-04-02
subject: java.util.Random isn't very random (at first)
lj-entry-id: 836,252

java.util.Random isn't very random (at first) - 2008-04-02 - Entry 1029 - TOGoS's Journal

If you plug consecutive seeds into the script linked to yesterday, you'll notice that the sky doesn't change much. That's because for consecutive seeds, new java.util.Random(seed)'s first values will be close together. I spent a few hours looking into that last night to make sure it wasn't a bug in my program. If you call theNewlyCreatedRandom.nextInt() a few times, the numbers you get back will start to look more random - I just happened to use the very first one to get the time of day in that script.

Dreams from lately:

There was a commuter railroad just south of the beltline in the area between the beltline, Hammersley, and Whitney Way. It was all snowy out, and I was walking with Heather back from somewhere on Whitney Way, so we took the train. It was fun. That area between Hammersley and the Beltline was a lot larger and had more buildings in it than in real life. It tends to contain a bit of unexplored terrain with farms and forests in my dreams.

I was talking to someone about the atmosphere on Mercury. We were sort of debating whether or not it had one. I pictured it as being so close to the sun that it got a bit of hot sun gas around it. It was scary.

I was watching an old movie, and at the end this couple was walking away along a little path and the narrator started talking about 'the first stinging whisps of winter air touching your face'. I thought about how sad it was that the warm sunny days were over, but then realized that in real life at this time it was coming to be spring, and was happy. And then I thought about how eventually summer would end again, and was sad again.