What kind of world?
If it's just a line of 1's and 0's, then:
#include <stdlib.h>
// create a random "world" with custom length
int* randomWorld(int length) {
// create an array "world" containing {length} integers
int *world = malloc(length * sizeof(int));
// set each integer in "world" to a random number from 0 to (2 - 1)
// meaning make every element 0 or 1
for (int i = 0; i < length; i++) world[i] = rand() % 2;
// get The World back
return world;
}