Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Simple Prng

Name: Anonymous 2014-05-13 1:00


// uses/requires a seed between 0 & 1
// returns values in range -1 to +1
function randout = sprng(n, seed, offset = 10)
randout = sin( ([1:n] .+ (offset + seed)) .^ 2.0 );
endfunction;

Name: Anonymous 2014-05-14 16:17

Indices should start at 1. touhou[1] = 'reimu'; because she is the first. The index number should be treated as an ordinal, but even when treated as a cardinal, it still fucks up cardinality. There is no good reason to have arrays start at 0 when literally every memory allocation method allocates based on a number of bytes. If C-style language's indices started at 1, it would remove 90% of bugs made by shitty programmers who can't reason (though, it was a mistake to give them anything more than VB6 to make GUIs in anyway).

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List