PRNG Utilities #183
Aliases: PRNG Utilities
4 verbs · 12 properties · 0 children
Verbs
| Verb | Spec | Flags | Definer | Lines |
|---|---|---|---|---|
random | this none this | rxd | #183 | 7 |
next | this none this | rxd | #183 | 6 |
clip | this none this | rxd | #183 | 2 |
randomlist | this none this | rxd | #183 | 12 |
Properties
| Property | Definer | Flags | Owner | Value |
|---|---|---|---|---|
seed | #183 | rc | #29 | -1626935562 |
help_msg | #72 | rc | #29 | list of 6{"Can use $prng_util instead of the objnum (#43383).", "", "A set of functions for generating pseudorandom numbers.", "", ":random([seed]) - Returns a list, [1] is the pseudorandom number, [2] is the new seed.", ":randomlist(count[, seed]) - Returns a list of pseudorandom numbers, [1..count] are the pseudorandom numbers, [count+1] is the new seed."} |
aliases | #1 | rc | #29 | {"PRNG Utilities"} |
description | #1 | rc | #29 | "Utilities for pseudorandom number generation." |
object_size | #1 | r | #29 | {2330, 1298434029} |
hidden_verbs | #1 | rc | #29 | <clear> |
phelp_msg | #1 | rc | #29 | <clear> |
weight | #1 | rc | #29 | <clear> |
owner_verbs | #1 | rc | #29 | <clear> |
plural_name | #1 | rc | #29 | <clear> |
client_image | #1 | rc | #29 | <clear> |
listening | #1 | rc | #29 | <clear> |
Ancestry
Ancestors (nearest first): #72 Generic Utilities Package → #1 root
Children: none
Call graph
Source
random
Referenced by
- #183:randomlist line 4:
this:random
Source
1if (length(args) == 0) 2seed = this:next(); 3this.seed = seed; 4else 5seed = this:next(@args); 6endif 7return {this:clip(seed), seed};
next
Referenced by
- #183:random line 2:
this:next - #183:random line 5:
this:next
Source
1if (length(args) == 0) 2value = this.seed; 3else 4value = args[1]; 5endif 6return (value * 214013) + 2531011;
clip
Referenced by
- #183:random line 7:
this:clip
Source
1"Equivilent of ((args[1] >> 16) & 0x7FFF)"; 2return $math_utils:IntFromBL($math_utils:BLFromInt(args[1])[2..16]);
randomlist
Referenced by
none
Source
1count = args[1]; 2values = {}; 3while (count > 0) 4result = this:random(@args[2..$]); 5if (length(args) > 1) 6args[2] = result[2]; 7endif 8values = listappend(values, result[1]); 9count = count - 1; 10endwhile 11values = listappend(values, result[2]); 12return values;