From f918675c8b11adb80a83000a3a984e4ff3bdcf1b Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Sun, 23 Oct 2016 19:45:36 -0700 Subject: 3569 Update syntax highlighting to not color numeric locations like literals. --- html/068random.mu.html | 62 +++++++++++++++++++++++++------------------------- 1 file changed, 31 insertions(+), 31 deletions(-) (limited to 'html/068random.mu.html') diff --git a/html/068random.mu.html b/html/068random.mu.html index 20b26659..05765f4e 100644 --- a/html/068random.mu.html +++ b/html/068random.mu.html @@ -37,10 +37,10 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color { break-if generator # generator is 0? use real random-number generator - result <- real-random + result <- real-random reply result, 0/false } - result, fail?, generator <- read generator + result, fail?, generator <- read generator ] # helper for tests @@ -48,61 +48,61 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color local-scope load-ingredients # compute result-len, space to allocate in result - result-len:num <- copy 0 + result-len:num <- copy 0 { - _, arg-received?:bool <- next-ingredient + _, arg-received?:bool <- next-ingredient break-unless arg-received? - result-len <- add result-len, 1 + result-len <- add result-len, 1 loop } rewind-ingredients - result-data:&:@:num <- new number:type, result-len - idx:num <- copy 0 + result-data:&:@:num <- new number:type, result-len + idx:num <- copy 0 { - curr:num, arg-received?:bool <- next-ingredient + curr:num, arg-received?:bool <- next-ingredient break-unless arg-received? - *result-data <- put-index *result-data, idx, curr - idx <- add idx, 1 + *result-data <- put-index *result-data, idx, curr + idx <- add idx, 1 loop } - result <- new-stream result-data + result <- new-stream result-data ] scenario random-numbers-in-scenario [ local-scope - source:&:stream:num <- assume-random-numbers 34, 35, 37 - 1:num/raw, 2:bool/raw <- random source - 3:num/raw, 4:bool/raw <- random source - 5:num/raw, 6:bool/raw <- random source - 7:num/raw, 8:bool/raw <- random source + source:&:stream:num <- assume-random-numbers 34, 35, 37 + 1:num/raw, 2:bool/raw <- random source + 3:num/raw, 4:bool/raw <- random source + 5:num/raw, 6:bool/raw <- random source + 7:num/raw, 8:bool/raw <- random source memory-should-contain [ - 1 <- 34 - 2 <- 0 # everything went well - 3 <- 35 - 4 <- 0 # everything went well - 5 <- 37 - 6 <- 0 # everything went well - 7 <- 0 # empty result - 8 <- 1 # end of stream + 1 <- 34 + 2 <- 0 # everything went well + 3 <- 35 + 4 <- 0 # everything went well + 5 <- 37 + 6 <- 0 # everything went well + 7 <- 0 # empty result + 8 <- 1 # end of stream ] ] def random-in-range generator:&:stream:num, start:num, end:num -> result:num, fail?:bool, generator:&:stream:num [ local-scope load-ingredients - result, fail?, generator <- random generator + result, fail?, generator <- random generator return-if fail? - delta:num <- subtract end, start - _, result <- divide-with-remainder result, delta - result <- add result, start + delta:num <- subtract end, start + _, result <- divide-with-remainder result, delta + result <- add result, start ] scenario random-in-range [ local-scope - source:&:stream:num <- assume-random-numbers 91 - 1:num/raw <- random-in-range source, 40, 50 + source:&:stream:num <- assume-random-numbers 91 + 1:num/raw <- random-in-range source, 40, 50 memory-should-contain [ - 1 <- 41 + 1 <- 41 ] ] -- cgit 1.4.1-2-gfad0