Avatar of nikeman_1479
nikeman_1479

asked on 

Random picking algorithm

Hi.
I'm searching in the internet for information, examples for algorithms, that can randomly pick a value from a define list of values, I found several examples that can do random on a array but thru the index of the array, what I want is: based on the values in each position of the array the algorithm picks a random value in each iteration until there are no values in the array. Example
int[] array = new int[]{4,245,653,9,12,50}
A possible output for this could be
50,4,9,12,653,245

I don't know if I explain my self well enough, thanks for any help, code example, link to pseudocode, or any type of information
.NET ProgrammingAlgorithmsGame Programming

Avatar of undefined
Last Comment
ozo
Avatar of ozo
ozo
Flag of United States of America image

Avatar of nikeman_1479
nikeman_1479

ASKER

Thanks for the reply, I also so that algorithm, and after reading what I have written, I didn't explain the idea correctly, what I want is to put the data randomly in N arrays depending on that N number, example:
int[] array = new int[]{4,245,653,9,12,50}
A possible output for this could be for two arrays
array A : 50,4,9,
array B: 12,653,245
I can use the shuffle to do a double shuffle, one for the picking and another for the attribution to one of the N arrays.
This will do the trick
ASKER CERTIFIED SOLUTION
Avatar of Mike Tomlinson
Mike Tomlinson
Flag of United States of America image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
SOLUTION
Avatar of ozo
ozo
Flag of United States of America image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
.NET Programming
.NET Programming

The .NET Framework is not specific to any one programming language; rather, it includes a library of functions that allows developers to rapidly build applications. Several supported languages include C#, VB.NET, C++ or ASP.NET.

137K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo