C#
C#

help

Root Question Message

Htk
Htk1/27/2023
✅ 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.
TheRanger
TheRanger1/27/2023
this is a C# server, maybe you should ask in a JS server?
Htk
Htk1/27/2023
well dot net is kinda related to C# right?
Angius
Angius1/27/2023
Sure
Angius
Angius1/27/2023
But you said it's JS code
Angius
Angius1/27/2023
And seeing the let and function seems to back that claim up
Htk
Htk1/27/2023
If needed it could be made on the backend side
Htk
Htk1/27/2023
But I preffer it to be on front
Angius
Angius1/27/2023
Well, a JS answer will be different than a C# answer, that's for sure
Angius
Angius1/27/2023
If you want it to be on the frontend, that's JS
Angius
Angius1/27/2023
So ask in $javascript maybe
Angius
Angius1/27/2023
$js
Angius
Angius1/27/2023
You're more likely to get JS help in a JS server than in a C# one
Htk
Htk1/27/2023
Thanks
ContactFrequently Asked QuestionsJoin The DiscordBugs & Feature RequestsTerms & Privacy