Spawning objects on infinite 2D terrain using a seed.

I’ve been experimenting with infinite 2d (top down) terrain generation using perlin noise. Here’s what I have so far:

  • Each world has a unique seed generated by random.nextLong().
  • Terrain is generated, saved and loaded in 16x16 chunk files.
  • The perlin noise returns a number between 0-0255, I use this to generate a heightmap.
  • Using the heightmap values I set a tile id, if its below 64 its water, above 64 its grass, about 150 its snow; for example.

This is pretty basic so I want to start adding objects like trees, bushes, rocks and basic structures. I don’t want to spawn objects by random chance because if I use the same seed again the terrain will be the same but the objects will be in different places.

I’m struggling with placing objects in the world using a seed, so they will always be in the same place if I use the seed again. Any ideas?