AnnieRuru
~~Cute~Cute~Scripter~~
- Messages
- 1,677
- Points
- 0
- Location
- your next door ~
- Discord
- AnnieRuru#1609
- Github
- AnnieRuru
- Emulator
- Client Version
- 2019-05-30aRagexeRE
I really need a topic for this shuffle algorithm or I have to keep press the search button non-stop
what is Shuffle Algorithm ?
- it generate a set of numbers in random order that the numbers are not repeated
Wiki -> http://en.wikipedia.org/wiki/Fisher–Yates_shuffle
This script is no longer necessary,
use the one inside Global Function
Commit Link
Credit to @Haru
Pull #872
what is Shuffle Algorithm ?
- it generate a set of numbers in random order that the numbers are not repeated
Wiki -> http://en.wikipedia.org/wiki/Fisher–Yates_shuffle
This script is no longer necessary,
use the one inside Global Function
Commit Link
Credit to @Haru
Pull #872
OUTDATED
Credit to @KeyWorld
http://www.eathena.ws/board/index.php?s=&showtopic=269819&view=findpost&p=1477362
Download:
http://upaste.me/fdc81111611fde9d2
.
.
.
PS: I want to click the Select Code button
tested with
Credit to @KeyWorld
http://www.eathena.ws/board/index.php?s=&showtopic=269819&view=findpost&p=1477362
Download:
http://upaste.me/fdc81111611fde9d2
.
.
.
PS: I want to click the Select Code button
Code:
// callfunc "shuffle", <start index>, <last index>, <output array>, <count>;function script shuffle__ { .@static = getarg(0); .@range = getarg(1) +1 - .@static; .@count = getarg(3, 0); if ( .@range <= 0 ) return 0; if ( !.@count || .@count > .@range ) .@count = .@range; while ( .@i < .@count ) { .@r = .@save = rand( .@i, .@range -1 ) ; if ( !.@tmp1[.@i] ) { .@r = .@tmp1[.@r] ? .@tmp2[.@r] : .@r; .@tmp2[.@i] = .@r; .@tmp2[.@save] = .@i; .@tmp1[.@save] = 1; set getelementofarray( getarg(2), .@i ), .@r + .@static; if ( .@save < .@count ) set getelementofarray( getarg(2), .@save ), .@i + .@static; } .@i++; } return .@count;}
Code:
prontera,156,184,5 script kjdshfksfjh 100,{// input .@min, -1000000000, 1000000000;// input .@[member="Max"], -1000000000, 1000000000; .@min = 1; .@[member="Max"] = 5; callfunc "shuffle__", .@min, .@[member="Max"], .@output$, 100; dispbottom implode( .@output$, "," );}
Last edited by a moderator:
