-
-
Save kitak/5632208 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var freshers = ["おっくん", "ぐっさん", "たけお", "きたけー"]; | |
freshers.shuffle = function () { | |
var i = this.length; | |
var j = 0; | |
var tmp = ""; | |
while(i) { | |
j = Math.floor(Math.random()*i); | |
i--; | |
tmp = this[i]; | |
this[i] = this[j]; | |
this[j] = tmp; | |
} | |
return this; | |
}; | |
freshers.shuffle(); | |
console.log(freshers.join(" | ")); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# coding: utf-8 | |
puts DATA.to_a.map(&:chomp).shuffle.join(' | ') | |
__END__ | |
たけお | |
きたけー | |
ぐっさん | |
おっくん |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use strict; | |
use List::Util; | |
my @name_list = ( "おっくん", "きたけー", "たけお", "ぐっさん" ); | |
my @s_name_list = List::Util::shuffle @name_list; | |
print join(", ", @s_name_list); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# coding: utf-8 | |
import random | |
import sys | |
reload(sys) | |
sys.setdefaultencoding('utf-8') | |
name_list = [ | |
u"おっくん", | |
u"きたけー", | |
u"たけお", | |
u"ぐっさん" | |
] | |
random.shuffle(name_list) | |
print name_list[0], name_list[1], name_list[2], name_list[3] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import random | |
name_list = [ | |
"おっくん", | |
"きたけー", | |
"たけお", | |
"ぐっさん" | |
] | |
random.shuffle(name_list) | |
print(name_list) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment