Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.forth > #9455

Re: Sets in Forth

From Paul Rubin <no.email@nospam.invalid>
Newsgroups comp.lang.forth
Subject Re: Sets in Forth
References <jgrfp0$m45$1@speranza.aioe.org> <2012Feb7.164443@mips.complang.tuwien.ac.at>
Date 2012-02-07 19:24 -0800
Message-ID <7xehu6qa6e.fsf@ruckus.brouhaha.com> (permalink)
Organization Nightsong/Fort GNOX

Show all headers | View raw


anton@mips.complang.tuwien.ac.at (Anton Ertl) writes:
> A simple array, initialized with numbers 1..24.  Select a random one,
> and swap it with the first one.  Select a random one of the remaining
> 23, and swap it with the next one; repeat until there is only one
> remaining number.

You are right about this.  The shuffling code that I posted (in case
anyone was thinking of using it for something) is subtly wrong and can
select permutations with unequal probabilities.  For n=24 the
nonuniformity would probably be hard to detect in practice, however.

Back to comp.lang.forth | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Sets in Forth Steve Graham <jsgrahamus@yahoo.com> - 2012-02-07 08:25 -0700
  Re: Sets in Forth anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-02-07 15:44 +0000
    Re: Sets in Forth Steve Graham <jsgrahamus@yahoo.com> - 2012-02-07 09:49 -0700
    Re: Sets in Forth Paul Rubin <no.email@nospam.invalid> - 2012-02-07 19:24 -0800
  Re: Sets in Forth mhx@iae.nl (Marcel Hendrix) - 2012-02-07 22:12 +0200

csiph-web