l i n u x - u s e r s - g r o u p - o f - d a v i s
Next Meeting:
July 7: Social gathering
Next Installfest:
Latest News:
Jun. 14: June LUGOD meeting cancelled
Page last updated:
2002 Nov 25 11:50

The following is an archive of a post made to our 'vox-tech mailing list' by one of its subscribers.

Report this post as spam:

(Enter your email address)
[vox-tech] shuffling arrays in C?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[vox-tech] shuffling arrays in C?

I've been looking around for a C library function that will shuffle the
elements of an arbitrarily long array.  I'd been hoping to turn up
something that would randomly shuffle the elements of an array.  The array
that I want to shuffle is made up of a class of structs that I've created.

A few hours of googling and fiddling with the man pages hasn't shed too
much light on the issue: the closest I've found was strfry, which is
supposed to randomize the order of a string.  I'm still a newbie, though,
so maybe don't know where to look.

I suppose that I might be able to hack something up to randomize the order
of an array by using strfry to scramble an array of chars corresponding to
indices, but wanted to check if there is a better way to do this.


"We must crush in its birth the aristocracy of our moneyed corporations,
which dare already to bid defiance to the laws of our country."
                                        -- Thomas Jefferson, 1812

(Quote courtesy of: http://www.algore04.com Yeah, I know... a democratic
website, but thought the quote was pretty good, assuming it's accurate.)

vox-tech mailing list

LUGOD Group on LinkedIn
Sign up for LUGOD event announcements
Your email address:
LUGOD Group on Facebook
'Like' LUGOD on Facebook:

Hosting provided by:
Sunset Systems
Sunset Systems offers preconfigured Linux systems, remote system administration and custom software development.

LUGOD: Linux Users' Group of Davis
PO Box 2082, Davis, CA 95617
Contact Us

LUGOD is a 501(c)7 non-profit organization
based in Davis, California
and serving the Sacramento area.
"Linux" is a trademark of Linus Torvalds.

Sponsored in part by:
EDGE Tech Corp.
For donating some give-aways for our meetings.