randomize

How can I print the lines in STDIN in random order in Perl?

I want to do the inverse of sort(1) : randomize every line of stdin to stdout in Perl. ...

place 20 chess pieces on a checkerboard, in random places

An idea I had to solve this, is to make up an buffer of size 8x8, fill it up with pointers to my checkers (all 20 of them), and the rest leave 0 (null), then run a shuffling algorithm on the buffer, and thats it (just read it as a 8x8 array) I was wondering if there's a better way to do this. I need to write it in C#, and my proposal w...

canonical way to randomize an NSArray in Objective C

Is there a canonical way to randomize an array in Objective C? ...

How can I randomize the lines in a file using a standard tools on Redhat Linux

How can I randomize the lines in a file using a standard tools on Redhat Linux? I don't have the "shuf" command, so I am looking for something like a perl or awk one liner that accomplishes the same task. ...

Practicing buffer overflow attack in Ubuntu

I am trying to learn to use buffer overflow attack in Ubuntu. Unfortunately, I cannot turn off Address Space Layout Randomization (ASLR) feature in this OS, which is turned on by default. I have tried some work around found in some fedora books: echo "0" > /proc/sys/kernel/randomize_va_space but for some reason the protection's still ...

Scramble a column in SQL Server?

We have a web app we'd like to demo to prospects, but our best way of doing so is with existing data, for a full experience. Certainly, we don't want to do this with actual customer names or addresses, etc visible in the app. Is there an easy way in SQL Server to randomize or scramble a varchar or text field? None of these columns are...

Randomization involving buttons (VB)

Using VB I can create and access a random "cell" in an array like so Dim array(5) as array Dim r as new random r.next(0,5) array(r) will then access a random "cell" based upon r's value. Is there a way to say something like button(r) to directly randomize which button is chosen instead of having to use a random and If's like so? r.n...

How can I get a randomized collection out of linq-to-sql model?

What's the right syntax for this? var words= from h in db.Words orderby(a => Guid.NewGuid()).ToList()) //error select h; var words= from h in db.Words orderby((a => Guid.NewGuid()).ToList()) //error select h; var words= from h in db.Words orderby...

Ruby - Subclassing array to make it randomize when flattened

I'm trying to subclass Array in ruby to make it randomize its elements when flatten! is called. Looking at the source code for Array#flatten (http://ruby-doc.org/core/classes/Array.src/M002218.html), it looks like it should recursively call flatten! on any array contained within an array. So, I tried doing something like this: class R...

I want to scramble an array in PHP

I want PHP to randomly create a multi-dimensional array by picking a vast amount of items out of predefined lists for n times, but never with 2 times the same. Let me put that to human words in a real-life example: i want to write a list of vegetables and meat and i want php to make a menu for me, with every day something else then yest...

picturebox image randomisation C#

Hi everyone, i am working on a puzzle slider program and trying to randomize images inside of pictureboxes. I did some research on the internet can't find any examples i could work on. These are my code: Random r = new Random(); PictureBox[] picBox = new PictureBox[9]; picBox[0] = new PictureBox(); picBo...

MySQL: applying a random sort on multiple columns

Hello. In order to have a well scrambled table (for a psychological experiment), I'd like to sort each column of my array by RAND(). Althrough this code works: SELECT Sort.Variable1, Sort.Variable2 FROM Sort ORDER BY Variable1, Variable2 ASC LIMIT 0 , 30 replacing "ASC" by "RAND()" make the query fail. Can someone give me an advice (e...

randomizing the string pulled from a plist file

I'm looking to randomize the output from a plist file. I've read about arc4random(), but I'm not sure how to incorporate it into the code. thanks for any help. here's the code that's currently pulling 'objectAtIndex:0' -(IBAction) buttonPress { NSString *path = [[NSBundle mainBundle] pathForResource:@"messages" ofType:@"plist"]...

Analysis of Permutation Finder algorithm(pseudo code)

A SO post about generating all the permutations got me thinking about a few alternative approaches. I was thinking about using space/run-time trade offs and was wondering if people could critique this approach and possible hiccups while trying to implement it in C#. The steps goes as follows: Given a data-structure of homogeneous elem...

PHP/jQuery populate content of squares randomly

Here is the scenario I am having problems with: I have a Wordpress page with 25 squares(divs!) on the page. I want to randomly populate the squares with: - either a thumbnail from a random post - or a background shade of red ( this shade of red may vary) Constraints: - I have the PHP code to populate the squares with a random posts t...

How reliable is the Random function in Delphi

I am writing a program which write statistical tests in Delphi (must be Delphi) and I've heard that the Random functionality is somewhat odd. You have to call randomize to randomize the seed of the random function when the program starts. I'm wondering if the random function (after calling randomize) is random enough for statistical t...