Thread Closed

How to randomize arrangement/order of output in C? (arrays)

 
Share Thread Thread Tools
Aug21-10, 10:48 PM   #1
 

How to randomize arrangement/order of output in C? (arrays)


1. The problem statement, all variables and given/known data

Hi I'm using C and I need to use arrays on this one, but I need to somehow randomize the output.



2. Relevant equations

for example an output "abcde" could also have an output "bcade" possible


3. The attempt at a solution

#include <stdio.h>

main()
{

char word[27] = "abcdefghijklmnopqrstuvwxyz";

printf("The contents of word[] is %c%c%c\n", word[0], word[1], word[3]);

}

the output of these one is "abc", but I want it to randomize it without rearranging the order of the output. In every run of the program, the order of the output should be diferent

example for every run, the output would be "bac" or "cba" etc.

Thanks!
 
PhysOrg.com
PhysOrg
science news on PhysOrg.com

>> Hong Kong launches first electric taxis
>> Morocco to harness the wind in energy hunt
>> Galaxy's Ring of Fire
Thread Closed

Tags
arrangement, arrays, c programming, randomize order
Thread Tools


Similar Threads for: How to randomize arrangement/order of output in C? (arrays)
Thread Forum Replies
First order upwind on collocated grid arrangement Mechanical Engineering 0
output voltage vs output current Electrical Engineering 1
Convert Digital Output from DAQ to Analog output? Electrical Engineering 4
Java project output problem. Can't output objects from a method. Engineering, Comp Sci, & Technology Homework 0
how to get output voltage from the tachometer output Engineering Systems & Design 1