✅ Pick random elements from array based on seed and randomise the order based also on seed.
I have an array with unique objects.
I'm writing this in fronted, Javascript and it looks should take these parameters:
let arrayWithObjects [new obj(x,y), new obj(a,b), new obj(d,e)... ] ;
function getRandomCards( seed, arrayWithObjects, newArrayLength){
//some code
return [x,y];
};
Seed is the parameter given by the user.
ArrayWithObjects is the array that I should take the objects out.
NewArrayLength should be the amount of object to pick.
TLDR:
Create a new array with a specified count by the user of unique objects from different array and then randomise the order(with seed parameter so that the outcome is repeatable), JavaScript.
8 Replies
this is a C# server, maybe you should ask in a JS server?
well dot net is kinda related to C# right?
Sure
But you said it's JS code
And seeing the
let
and function
seems to back that claim upIf needed it could be made on the backend side
But I preffer it to be on front
Well, a JS answer will be different than a C# answer, that's for sure
If you want it to be on the frontend, that's JS
So ask in $javascript maybe
$js
You're more likely to get JS help in a JS server than in a C# one
Thanks