How do you sow PRNG with two seeds?

For the game I am doing where the solar systems have x and y coordinates, I would like to use the coordinates to randomly generate functions for this solar system. The easiest way to do this seems to populate a random number generator with two seeds, x and y coordinates. Is there anyway to get one reliable seed from two seeds, or is there a good PRNG that takes two seeds and produces long periods?

EDIT: I know about binary operations between two numbers, but I'm trying to find a method that will lead to the least amount of collisions? Addition and multiplication will easily lead to collisions. But what about XOR?

+3
source share
6 answers

. , , , , , , :

seed = (x << 32) + y
+7
seed1 ^ seed2

( ^ - XOR)

+2

PRNG 2 . , 10. , 1,5 ; , 1000000 10 ^ 6 1 500 000. :

Input "Enter power for 10^n modulus";m
Mod& = 10 ^ m
Input "Enter # of iterations"; n
Input "Enter seed #1"; a
Input "Enter seed #2"; b
Loop = 1
For loop = 1 to n
C = a + b
If c > m then c = c - m
A = b
B = c
Next

. .

+1

- - 10. . , - - , . -, .

edit - - f1 = , f2 = G = (sqrt (5) + 1)/2....

- . Xn = Xn-1 + Xn-2 mod (G) mod (1) ( 0 1), , -,

, , , ...

, f1 f2 , , ...

counter = f1 = Xn f2 = Xn - -. ... ​​ Xn * .

, Xn Xn - - f1 f2, , , , .

.... , ...

0

, ? , , , , , ?

, .

, ( , - ). , , , .

0

PRNG :

http://www.math.uni-bielefeld.de/~sillke/ALGORITHMS/random/marsaglia-c

He clearly relies on two seeds, so he can only what you are looking for.

0
source

Source: https://habr.com/ru/post/1717453/


All Articles