MathGroup Archive 1998

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: choose with replacement

Daniel Sanders wrote:
> Hi,
> I'm new to Mathematica programming, and I'm a bit stumped to find the
> code for the following maybe someone has a suggestion.
> Simply put, I want to make a new list from an existing finite list by
> randomly choosing an element from list_1 to be included in list_2.
> List_1 would loose that element, and the random number generator would
> be reduced to correspond to the new length of the old list_1.  This
> process would continue untill list_1 has no elements, and list_2 has
> all the elements of list_1 reordered.
> I have a feeling that this is not hard to do, but I can't seem to get it
> right.  Any suggestions?
> Dan

This comes to mind.  I think you could also use FixedPointList with
SameTest checking for when the first list is empty.


Ken Levasseur

************************************************* Dr. Kenneth M.
Levasseur                        * Chair, Mathematical Sciences        
* UMass Lowell, Lowell MA  01854                  * Voice: (978)
934-2414                           * Fax:   (978)934-3053              
*               *     *

  • Prev by Date: How do u go about doing this---?
  • Next by Date: Re: Calc formula from table
  • Prev by thread: choose with replacement
  • Next by thread: RE: choose with replacement