Live data from Hacker News

Shuffling

datagenetics.com

11–17 of 17 posts

Re: Shuffling

#11
post #10

I love the idea of combining this with the idea of proving code. Like, "how can I prove my approach 'shuffles' an array?" ... I mean, just because it looks right... doesn't mean it is.

Really useful to remind yourself of this!

Re: Shuffling

#12
While understanding the how/why of algorithms is great, a word of advice: If this were a real project and your standard library has a shuffle() function, just use that one and get on with life.

Save yourself from having to worry about your hand-crafted one being subtly wrong. Save your peers from having to debug your hand-crafted one years after you've left the company. This tip goes for basically any routine that already comes built-into your language or libraries. Spend your time writing code that doesn't already exist. I'm looking at you, co-worker from 5 or so years ago who felt he had to re-implement strings, linked lists, and sorting.

Re: Shuffling

#13

Earlier quoted context omitted.

Yes, it is VB6. I did actually put quite a bit of thought into how I was going to put in the code samples. I elected to use BASIC like syntax because IMHO, this is close to as common denominator as possible and most universally understood (this is not an invite to start a flame war!) I also elected to start by arrays at 1, rather than 0. The purest in my wanted to use zero, but to make it more universally understood,…

numbering should start at 0. http://www.cs.utexas.edu/users/EWD/transcriptions/EWD08xx/EW... He also made comments about using Basic. Seems you made the wrong choices...

I think your mom made the wrong choice.

Re: Shuffling

#14

Earlier quoted context omitted.

It's looks very close to Visual Basic to me ... :)

Yes, it is VB6. I did actually put quite a bit of thought into how I was going to put in the code samples. I elected to use BASIC like syntax because IMHO, this is close to as common denominator as possible and most universally understood (this is not an invite to start a flame war!) I also elected to start by arrays at 1, rather than 0. The purest in my wanted to use zero, but to make it more universally understood,…

As a civilian (i.e. non-programmer) I found the example code understandable. I too am wondering what alternative presentation method the post above yours would suggest.

Nice article.

Re: Shuffling

#15

Earlier quoted context omitted.

Yes, it is VB6. I did actually put quite a bit of thought into how I was going to put in the code samples. I elected to use BASIC like syntax because IMHO, this is close to as common denominator as possible and most universally understood (this is not an invite to start a flame war!) I also elected to start by arrays at 1, rather than 0. The purest in my wanted to use zero, but to make it more universally understood,…

As a civilian (i.e. non-programmer) I found the example code understandable. I too am wondering what alternative presentation method the post above yours would suggest. Nice article.

Coming from python and not knowing VB I found the Do Loop syntax tricky at first. I am used to a loop explaining how long it will run for at the top (similar to the for loop here).

Being pseudocode I found it odd to mix loop syntax. One loop has its conditions at the top and the other at the bottom. I guess that is just taste though.

Post reply on HN