Task: Matrix digital rain

C: 
#include <unistd.h>
#include <time.h>
#include <stdio.h>
#include <stdlib.h>
#include <ncurses.h>


#define ROW_DELAY 40000


int get_rand_in_range(int min, int max)
{
  return (rand() % ((max + 1) - min) + min);
}

int main(void)
{
  
  srand(time(NULL));

  
  char chars[] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9'};

  int total_chars = sizeof(chars);

  
  initscr();
  noecho();
  curs_set(FALSE);

  start_color();
  init_pair(1, COLOR_GREEN, COLOR_BLACK);
  attron(COLOR_PAIR(1));

  int max_x = 0, max_y = 0;

  getmaxyx(stdscr, max_y, max_x);

  

  
  int columns_row[max_x];

  
  int columns_active[max_x];

  int i;

  
  for (i = 0; i < max_x; i++)
  {
    columns_row[i] = -1;
    columns_active[i] = 0;
  }

  while (1)
  {
    for (i = 0; i < max_x; i++)
    {
      if (columns_row[i] == -1)
      {
        
        columns_row[i] = get_rand_in_range(0, max_y);
        columns_active[i] = get_rand_in_range(0, 1);
      }
    }

    
    for (i = 0; i < max_x; i++)
    {
      if (columns_active[i] == 1)
      {
        
        int char_index = get_rand_in_range(0, total_chars);
        mvprintw(columns_row[i], i, "%c", chars[char_index]);
      }
      else
      {
        
        mvprintw(columns_row[i], i, " ");
      }

      columns_row[i]++;

      
      if (columns_row[i] >= max_y)
      {
        columns_row[i] = -1;
      }

      
      if (get_rand_in_range(0, 1000) == 0)
      {
        columns_active[i] = (columns_active[i] == 0) ? 1 : 0;
      }
    }

    usleep(ROW_DELAY);
    refresh();
  }

  endwin();
  return 0;
}




Go: package main

import (
    gc "github.com/rthornton128/goncurses"
    "log"
    "math/rand"
    "time"
)



const rowDelay = 40000

func main() {
    start := time.Now()
    rand.Seed(time.Now().UnixNano())

    
    chars := []byte("0123456789")
    totalChars := len(chars)

    
    stdscr, err := gc.Init()
    if err != nil {
        log.Fatal("init", err)
    }
    defer gc.End()

    gc.Echo(false)
    gc.Cursor(0)

    if !gc.HasColors() {
        log.Fatal("Program requires a colour capable terminal")
    }

    if err := gc.StartColor(); err != nil {
        log.Fatal(err)
    }

    if err := gc.InitPair(1, gc.C_GREEN, gc.C_BLACK); err != nil {
        log.Fatal("InitPair failed: ", err)
    }
    stdscr.ColorOn(1)
    maxY, maxX := stdscr.MaxYX()

    

    
    columnsRow := make([]int, maxX)

    
    
    columnsActive := make([]int, maxX)

    
    for i := 0; i < maxX; i++ {
        columnsRow[i] = -1
        columnsActive[i] = 0
    }

    for {
        for i := 0; i < maxX; i++ {
            if columnsRow[i] == -1 {
                
                
                columnsRow[i] = rand.Intn(maxY + 1)
                columnsActive[i] = rand.Intn(2)
            }
        }

        
        for i := 0; i < maxX; i++ {
            if columnsActive[i] == 1 {
                
                charIndex := rand.Intn(totalChars)
                stdscr.MovePrintf(columnsRow[i], i, "%c", chars[charIndex])
            } else {
                
                stdscr.MovePrintf(columnsRow[i], i, "%c", ' ')
            }

            columnsRow[i]++

            
            if columnsRow[i] >= maxY {
                columnsRow[i] = -1
            }

            
            if rand.Intn(1001) == 0 {
                if columnsActive[i] == 0 {
                    columnsActive[i] = 1
                } else {
                    columnsActive[i] = 0
                }
            }
        }
        time.Sleep(rowDelay * time.Microsecond)
        stdscr.Refresh()
        elapsed := time.Since(start)
        
        if elapsed.Minutes() >= 1 {
            break
        }
    }
}