1. Home
  2. /
  3. Elvish
  4. /
  5. Random Walk Simulation

Random Walk Simulation - Elvish Typing CST Test

Loading…

Random Walk Simulation — Elvish Code

Simulates a 1D random walk.

steps = 10
pos = 0
for i (1..$steps) {
	if (random 1 < 0.5) {
		pos = (math $pos + 1)
	} else {
		pos = (math $pos - 1)
	}
	echo $pos
}

Elvish Language Guide

Elvish is a modern, expressive shell and scripting language designed for interactive use and automation. It emphasizes structured data, pipelines, modularity, and user-friendly syntax, combining features from traditional Unix shells with modern programming concepts.

Primary Use Cases

  • ▸Interactive shell for Unix/Linux systems
  • ▸Automation scripts for system tasks
  • ▸Structured data pipelines and processing
  • ▸Custom command extensions
  • ▸Rapid prototyping of shell scripts

Notable Features

  • ▸Structured data pipelines with lists, maps, and records
  • ▸Modern, user-friendly syntax
  • ▸Built-in support for functions, modules, and namespaces
  • ▸Interactive editing and command completion
  • ▸Error handling and rich debugging features

Origin & Creator

Created by Jeffrey Shu, first released in 2014.

Industrial Note

Elvish is particularly useful in environments where shell automation, interactive data processing, and structured scripting pipelines are needed.

More Elvish Typing Exercises

Elvish Counter and Theme ToggleElvish Fibonacci SequenceElvish Factorial CalculatorElvish Prime CheckerElvish Sum of ListElvish Reverse StringElvish Multiplication TableElvish Celsius to FahrenheitElvish Simple Alarm Simulation

Practice Other Languages

CReactPythonC++RustTypeScriptKotlinPHPJavaC#RubyMqlCqlN1qlCypher