<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/">
	<channel>
		<title>Generating random arrangement of columns in sets of equal length</title>
		<link>/blogentry/26651</link>
		<atom:link href="https://www.lotterypost.com/rss/blogcomments/26651" rel="self" type="application/rss+xml" />
		<description>edge's Blog: Generating random arrangement of columns in sets of equal length</description>
		<dc:language>en-us</dc:language>
		<generator>Lottery Post RSS Generator</generator>
		<item>
			<title>Original Blog Entry: Generating random arrangement of columns in sets of equal length</title>
			<link>/blogentry/26651</link>
			<guid isPermaLink="true">/blogentry/26651</guid>
			<pubDate>Wed, 07 Jan 2009 22:45:21 GMT</pubDate>
			<dc:creator>edge</dc:creator>
			<description><![CDATA[<p> Based on the java package from Fermi Labs (randomX) that uses decay of C sium-137 particle as the source of random numbers,(hence quantum mechanical physical process for which no known algorithmic explanation exists - extending big thanks to JadeLottery for pointing this out to me!), created this small application to basically take any number of sets and length and create output consisting of sets of the same size but with random column permutations.<br /><br />Program takes 4 inputs:<br /><br />iterations - number of times application should run complete full cycle<br /><br />max - length of set<br /><br />sets - number of sets<br /><br />input - 2 dimensional input array<br /><br />and an one output: (displayed to the console):<br /><br />output - 2 dimensional randomized output array<br /><br />Example of an output generated by this application:<br /><br />Input sets:<br /><br />06-12-18-31-39-40-43-51-63-71<br /><br />13-25-34-37-41-55-58-61-77-79<br /><br />14-21-33-36-38-50-53-62-69-76<br /><br />Output sets after 10 iterations:<br /><br />13-12-18-37-41-50-53-51-63-76<br /><br />06-21-34-31-38-55-58-61-77-71<br /><br />14-25-33-36-39-40-43-62-69-79<br /><br />The application could be used to study various strategies as to i.e. measuring how a non-random, pattern-based system predictions compare to predictions made by a truly random process agent.<br /><br />One could further extend it by assigning weight (bias) to the indvidual number(s) (lock) something I have not implemented keeping implementation to bare minimum.<br /><br />Example provided will generate randomized pick-10 matrix-set after 10 iterations.<br /><br />Hope this will be useful to anyone testing their prediction model(s)!<br /><br />source:<br /><br />/* Generates random arrangement of columns in sets of equal length */<br /><br />import randomX.*;<br /><br />class randomXdemo {<br /><br />public static void main(String[] args) {<br /><br />int iterations = 10;<br /><br />int max = 10;<br /><br />int sets = 3;<br /><br />int input[][] = {{6,12,18,31,39,40,43,51,63,71},<br /><br />{13,25,34,37,41,55,58,61,77,79},<br /><br />{14,21,33,36,38,50,53,62,69,76}};<br /><br />/*<br /><br />int max = 4;<br /><br />int sets = 6;<br /><br />int input[][] = {{1, 3, 2, 6},<br /><br />{3, 9, 1, 5},<br /><br />{4, 8, 9, 4},<br /><br />{5, 6, 0, 1},<br /><br />{6, 4, 8, 3},<br /><br />{9, 1, 5, 2}};*/<br /><br />/*<br /><br />int max = 6;<br /><br />int sets = 6;<br /><br />int input[][] = {{3, 12, 14, 33, 49, 51},<br /><br />{4, 6, 21, 25, 48, 50},<br /><br />{5, 17, 20, 22, 29, 45},<br /><br />{10, 18, 23, 42, 43, 55},<br /><br />{15, 19, 27, 34, 36, 37},<br /><br />{16, 30, 38, 44, 54, 56}};<br /><br />*/<br /><br />int output[][] = new int[sets][max];<br /><br />display( Input sets:\n\n , input, sets, max);<br /><br />randomX r = new randomLEcuyer();<br /><br />for (int n = 0; n iterations; n++) {<br /><br />init(output, max, sets);<br /><br />for (int i = 0; i max; i++) {<br /><br />for (int j = 0; j sets; j++) {<br /><br />output[find(r, 0, sets, i, output)][i] = input[j][i];<br /><br />}<br /><br />}<br /><br />}<br /><br />display( Output sets after + iterations + iterations:\n\n , output, sets, max);<br /><br />}<br /><br />static void init(int output[][], int max, int sets) {<br /><br />for (int i = 0; i max; i++) {<br /><br />for (int j = 0; j sets; j++)<br /><br />output[j][i] = -1;<br /><br />}<br /><br />}<br /><br />}<br /><br />static int find(randomX r, int lBound, int uBound, int i, int output[][]) {<br /><br />int n = 0;<br /><br />do {<br /><br />n = int2range(byte2int(r.nextByte()), lBound, uBound-1);<br /><br />} while (output[n][i] != -1);<br /><br />return n;<br /><br />}<br /><br />static int int2range(int i, int lBound, int uBound) {<br /><br />return (int)(i % (uBound-lBound + 1)) + lBound;<br /><br />}<br /><br />static int byte2int(byte b) {<br /><br />if (b 0)<br /><br />return (int)b + 0x100;<br /><br />return b;<br /><br />}<br /><br />static void display(String title, int output[][], int sets, int max) {<br /><br />int n = 0;<br /><br />StringBuffer sb = new StringBuffer();<br /><br />sb.append(title);<br /><br />for (int j = 0; j sets; j++) {<br /><br />for (int i = 0; i max; i++) {<br /><br />n = output[j][i];<br /><br />if (n 10)<br /><br />sb.append( 0 );<br /><br />sb.append(n);<br /><br />if (i max-1)<br /><br />sb.append( - );<br /><br />}<br /><br />sb.append( \n );<br /><br />}<br /><br />System.out.println(sb.toString());<br /><br />}<br /><br />}<br /><br />/* source end */<br /><br />... &#x5b;&#xa0;<a href="/blogentry/26651">More</a>&#xa0;&#x5d;</p>]]></description>
			<category>Blog Entry</category>
			<category>edge</category>
			<wfw:comment>https://www.lotterypost.com/blogentry/26651</wfw:comment>
		</item>
	</channel>
</rss>

