:once # Creating lists and a starting mapconstant for the seed sequences. createlist ->prevSeedList createlist ->seedCountList getmapsize 2 div swap 2 div swap dup2 getterrain 1 add dup 99999 floodfillterrain getlistcount ->mapConstant # Setting up the messages so that other scripts can request a random seed. "sinRandInt" "sinRandInt_CALL" registerformsg "sinRand01" "sinRand01_CALL" registerformsg "indexSinRandInt" "indexSinRandInt_CALL" registerformsg "indexSinRand01" "indexSinRand01_CALL" registerformsg "spikedSinRandInt" "spikedSinRandInt_CALL" registerformsg "spikedSinRand01" "spikedSinRand01_CALL" registerformsg "seededSinRandInt" "seededSinRandInt_CALL" registerformsg "seededSinRand01" "seededSinRand01_CALL" registerformsg :sinRandInt_CALL <-_DATA listtostack @sinRandInt ->*sinRandInt :sinRand01_CALL @sinRand01 ->*sinRand01 :indexSinRandInt_CALL <-_DATA listtostack @indexSinRandInt ->*sinRandInt :indexSinRand01_CALL <-_DATA @indexSinRand01 ->*sinRand01 :spikedSinRandInt_CALL <-_DATA listtostack @spikedSinRandInt ->*sinRandInt :spikedSinRand01_CALL @spikedSinRand01 ->*sinRand01 :seededSinRandInt_CALL <-_DATA listtostack @seededSinRandInt ->*sinRandInt :seededSinRand01_CALL <-_DATA @seededSinRand01 ->*sinRand01 :sinRandInt # INPUT: integer first randInt + integer last randInt. OUTPUT: an integer in between the first and last randInt, excluding the last randInt. ->last ->first 0 @indexSinRand01 <-last <-first sub mul <-first add asint :sinRand01 # INPUT: none. 0 @indexSinRand01 :indexSinRandInt # INPUT: the index of the seed sequence + integer first randInt + integer last randInt. OUTPUT: an integer in between the first and last randInt, excluding the last randInt. ->last ->first @indexSinRand01 <-last <-first sub mul <-first add asint :indexSinRand01 # INPUT: the "index" of the seed sequence. OUTPUT: the next seed from that sequence. # The random numbers will be generated with the previous seed that is stored under that index. ->i <-prevSeedList[<-i] eq0 if <-i <-mapConstant add 2357 mul @seededSinRand01 dup 10000000 mul 1 add asint ->prevSeedList[<-i] 1 ->seedCountList[<-i] else <-prevSeedList[<-i] @seededSinRand01 dup 10000000 mul <-seedCountList[<-i] 1 add dup ->seedCountList[<-i] add asint ->prevSeedList[<-i] endif :spikedSinRandInt # INPUT: integer first randInt + integer last randInt. OUTPUT: an integer in between the first and last randInt, excluding the last randInt. ->last ->first elapsedtime asint @seededSinRand01 <-last <-first sub mul <-first add asint :spikedSinRand01 elapsedtime asint @seededSinRand01 :seededSinRandInt # INPUT: integer seed + integer first randInt + integer last randInt. OUTPUT: an integer in between the first and last randInt, excluding the last randInt. ->last ->first @seededSinRand01 <-last <-first sub mul <-first add asint :seededSinRand01 # abs <-power pow <-add add sin <-sinMul mul dup floor sub 1.05 pow 99419 sub sin 619 mul dup floor sub