Quantcast
Channel: Step-by-step re-arranging of a string with randomized characters - Code Review Stack Exchange
Browsing latest articles
Browse All 4 View Live

Answer by chux - Reinstate Monica for Step-by-step re-arranging of a string...

Proper randomization?Given " lelCoH", how is output " elloCC" a proper re-arrangement?Candidate scramble alternative// Unchecked code#define N 7char consumable_copy[N+1];strcpy(consumable_copy,...

View Article


Step-by-step re-arranging of a string with randomized characters

A sloppy code featuring algorithms to efficiently randomize the characters of a string "Hello C" and then print out in the console the re-arrangement process for every character.#include...

View Article

Answer by Peter Cordes for Step-by-step re-arranging of a string with...

rand() is quite slow on modern GNU/Linux compared to a good modern PRNG. The Glibc implementation takes/releases a lock even in a single-threaded program. (To see this, compile a program like int...

View Article

Answer by Harith for Step-by-step re-arranging of a string with randomized...

Avoid magic numbers: char characters[8] = "Hello C"; /* Keeps track of used characters */ int iCharacters = 7; /* Number of unused characters */ char scrambled[8] = {'\0'}; /* First scrambled string */...

View Article
Browsing latest articles
Browse All 4 View Live




<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>