Hi Ville,

let's assume you have 5,000 reflections and want 50 reflections to be in the 
same bin (i.e. flagged with the same Rfree flag).

You enumerate your reflections and create a parallel list with 50 zeros, 50 
ones, 50 twos, ... 50 onehundreds.

Then you run through the second list, and swap every number with an random 
position, and place this back next to your list of reflections. When you bin 
all zeros, all ones, etc, you end up with a random distribution across all 
relfections and each bin has (about) the same size.

In most cases, the bin size won't divide the total number of reflections. In 
that case you could either leave the last bin smaller, or you could distribute 
the remaining reflections randomly across the remaining bins.

When you create the initial 'parallel list', you can take various special 
cases into account, like flagging reflections related by NCS, or twin law, 
etc.

Best wishes, 
Tim
On Tuesday 31 January 2017 11:45:16 AM Ville Uski wrote:
> On Tue, Jan 31, 2017 at 03:29:15AM +0100, Tim Gruene wrote:
> > I had long wondered how to flag the fields in game minesweeper with a
> > deterministic algorithm. When I read about 'random sort and bin' I though
> > this was quite a beautiful way. I wonder if there is any reason behind
> > not doing it this way in freerflag.
> 
> it could do that if requested.. What exactly means 'random sort
> and bin'?
> 
> Ville
-- 
--
Paul Scherrer Institut
Dr. Tim Gruene
- persoenlich -
Principal Investigator
Biology and Chemistry
OFLC/102
CH-5232 Villigen PSI

Phone: +41 (0)56 310 5297

GPG Key ID = A46BEE1A

Attachment: signature.asc
Description: This is a digitally signed message part.

Reply via email to