Vector 3 to float eg V3(1, 2, 3) -> float 123 in JS?

Hi everyone,

We are doing some programming where we need to generate a float seed based of a vector 3 value, is there any efficient/simple way of taking a Vector3 such as Vector3(1, 2, 3) and turning it into a float 123?

there are numerous solutions:
If the components of the vector are single digits, you could multiply them by 100,10,1 and then add them together:

seed = vector.x100+vector.y10+vector.z;

Actually, that solution works for any number of digits, you could just change the scalars

If you don’t actually care about what the final value is, you could use bitshifting.
I’m not too sure of the syntax in C# or js (most of my knowledge is in Java), but it’d be something like this:
seed = vector.x<<16|vector.y<<8|vector.z;
derp… I just remembered you can’t bitshift floats (at least in c#), you could make them ints first…

Hopefully if I haven’t answered your question, I at least gave you some ideas!