# Turn a large number into a value between 2 numbers

0 favourites
• 6 posts
From the Asset Store
A well commented RPG game template to learn from or use as a base for your own game!
• Hey,

So, I'm working on procedural generation, and I want it to work off a seed system. As in, you find a cool world, copy the seed, he pastes it into his game, and gets the same world. Therefor, I can't use any random values, because it would defeat the purpose of the seed system. Because of this, I need to find a way to generate somewhat random seeming values from a string of numbers, my "seed".

My seed consists of purely numbers, to simplify things. My seed can be anywhere between 1, and 10,000,000.

so let's say, I get the seed 76364, I need a way, to turn that into a number between say 1 and 10.

### But

The outcome cannot be constant. The formula needs to incorporate outside factors. Say if I have blocks all over my level, I'd need to vary the formula in some way to include block.x and block.y, so that

A: All the blocks dont have the same number,

B: all the blocks in the same X row dont have the same number,

C: all the blocks in the same Y row dont have the same number.

Hopefully one of you amazing geniuses can help me out with this one

• ## Try Construct 3

Develop games in your browser. Powerful, performant & highly capable.

Construct 3 users don't see these ads
• Two ideas come to mind. One is to use the third party noise plugin. With it you can set a seed and get random values over a grid with perlin noise.

The second idea is to use a random number generator. A simple one is rather easy to write but the quality won't be there. More complex ones will give better values.

• Not sure if you understood my original post or not, sorry, but I need to avoid using random numbers, so that my seed idea works, if possible

• as for the perlin noise plugin, tried to find it, and I cant seem to find it? Could you link me? R0J0hound

• I did understand it. You want a seeded random number generator.

These are the three plugins that can do a seeded random:

viewtopic.php?t=93998&start=0

viewtopic.php?t=63543&start=0

viewtopic.php?t=76204&start=0

And btw here is where you go to find a list of all the plugins:

c2-plugins-and-behaviors-list_t65170

If you wan to do it yourself the simplest way is this:

https://en.wikipedia.org/wiki/Linear_co ... _generator

Wikipedia also lists other methods here if you're curious:

https://en.wikipedia.org/wiki/Random_nu ... al_methods

• Sorry I think I misunderstood what you said in the first message and it made me think you didnt understand, my english isn't the best at times Thanks a bunch for those links, you're the best! R0J0hound

• 6 posts