{"id":372,"date":"2004-03-08T10:27:57","date_gmt":"2004-03-08T15:27:57","guid":{"rendered":"http:\/\/blogs.law.harvard.edu\/hoanga\/2004\/03\/08\/not-the-kitchen-sink-but-almost-gcc-ha"},"modified":"2004-03-08T10:27:57","modified_gmt":"2004-03-08T15:27:57","slug":"not-the-kitchen-sink-but-almost-gcc-has-the-strfry-function","status":"publish","type":"post","link":"https:\/\/archive.blogs.harvard.edu\/hoanga\/2004\/03\/08\/not-the-kitchen-sink-but-almost-gcc-has-the-strfry-function\/","title":{"rendered":"Not the kitchen sink but almost (GCC has the strfry function)"},"content":{"rendered":"<p><a name='a327'><\/a><\/p>\n<p>\nThis just boggles me:<br \/>\n<br \/>\n(Gratuitously cut and pasted from the GNU C Library)\n<\/p>\n<h3>strfry<\/h3>\n<p>The function below addresses the perennial programming quandary: &#8220;How do<br \/>\nI take good data in string form and painlessly turn it into garbage?&#8221;<br \/>\nThis is actually a fairly simple task for C programmers who do not use<br \/>\nthe GNU C library string functions, but for programs based on the GNU C<br \/>\nlibrary, the <code>strfry<\/code> function is the preferred method for<br \/>\ndestroying string data.<\/p>\n<p>The prototype for this function is in <code>string.h<\/code>.<\/p>\n<table width=\"100%\">\n<tr>\n<td align=\"left\">char * <b>strfry<\/b><i> (char *string)<br \/>\n<\/i><\/td>\n<td align=\"right\">Function<\/td>\n<\/tr>\n<\/table>\n<table width=\"95%\" align=\"center\">\n<tr>\n<td>\n<p><code>strfry<\/code> creates a pseudorandom anagram of a string, replacing the<br \/>\ninput with the anagram in place.  For each position in the string,<br \/>\n<code>strfry<\/code> swaps it with a position in the string selected at random<br \/>\n(from a uniform distribution).  The two positions may be the same.\n<\/p>\n<p>The return value of <code>strfry<\/code> is always <var>string<\/var>.\n<\/p>\n<p><strong>Portability Note:<\/strong>  This function is unique to the GNU C library.\n<\/p>\n<\/td>\n<\/tr>\n<\/table>\n<p>\n<a href=\"http:\/\/www.gnu.org\/software\/libc\/manual\/html_node\/strfry.html#strfry\">To the GNU C library strfry page<\/a><br \/>\n<br \/>\nKudos to <a href=\"http:\/\/www.aaronsw.com\">Aaron Swartz<\/a> for pointing this out\n<\/p>\n<\/tr>\n<\/td>\n<\/table>\n","protected":false},"excerpt":{"rendered":"<p>This just boggles me: (Gratuitously cut and pasted from the GNU C Library) strfry The function below addresses the perennial programming quandary: &#8220;How do I take good data in string form and painlessly turn it into garbage?&#8221; This is actually a fairly simple task for C programmers who do not use the GNU C library [&hellip;]<\/p>\n","protected":false},"author":704,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1212],"tags":[],"class_list":["post-372","post","type-post","status-publish","format-standard","hentry","category-tagme"],"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/archive.blogs.harvard.edu\/hoanga\/wp-json\/wp\/v2\/posts\/372","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/archive.blogs.harvard.edu\/hoanga\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/archive.blogs.harvard.edu\/hoanga\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/archive.blogs.harvard.edu\/hoanga\/wp-json\/wp\/v2\/users\/704"}],"replies":[{"embeddable":true,"href":"https:\/\/archive.blogs.harvard.edu\/hoanga\/wp-json\/wp\/v2\/comments?post=372"}],"version-history":[{"count":0,"href":"https:\/\/archive.blogs.harvard.edu\/hoanga\/wp-json\/wp\/v2\/posts\/372\/revisions"}],"wp:attachment":[{"href":"https:\/\/archive.blogs.harvard.edu\/hoanga\/wp-json\/wp\/v2\/media?parent=372"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/archive.blogs.harvard.edu\/hoanga\/wp-json\/wp\/v2\/categories?post=372"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/archive.blogs.harvard.edu\/hoanga\/wp-json\/wp\/v2\/tags?post=372"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}