{"id":43864,"date":"2025-08-05T16:33:41","date_gmt":"2025-08-05T07:33:41","guid":{"rendered":"https:\/\/techgym.jp\/?p=43864"},"modified":"2025-10-19T23:15:52","modified_gmt":"2025-10-19T14:15:52","slug":"python-random-choice","status":"publish","type":"post","link":"https:\/\/techgym.jp\/column\/python-random-choice\/","title":{"rendered":"Python random.choice\u30fbsample\u30fbchoices\u5b8c\u5168\u30ac\u30a4\u30c9 &#8211; \u30e9\u30f3\u30c0\u30e0\u9078\u629e\u306e\u4f7f\u3044\u5206\u3051\u3092\u5fb9\u5e95\u89e3\u8aac"},"content":{"rendered":"\n<p><iframe loading=\"lazy\" width=\"560\" height=\"314\" src=\"\/\/www.youtube.com\/embed\/7iX9nAJE0cE\" allowfullscreen=\"allowfullscreen\"><\/iframe><\/p>\n<p>Python\u306erandom\u30e2\u30b8\u30e5\u30fc\u30eb\u306b\u306f\u3001\u30ea\u30b9\u30c8\u3084\u914d\u5217\u304b\u3089\u30e9\u30f3\u30c0\u30e0\u306b\u8981\u7d20\u3092\u9078\u629e\u3059\u308b\u305f\u3081\u306e3\u3064\u306e\u4e3b\u8981\u306a\u95a2\u6570\u304c\u3042\u308a\u307e\u3059\uff1a<code>choice()<\/code>\u3001<code>sample()<\/code>\u3001<code>choices()<\/code>\u3002\u305d\u308c\u305e\u308c\u7570\u306a\u308b\u7279\u5fb4\u3068\u7528\u9014\u3092\u6301\u3061\u3001\u9069\u5207\u306b\u4f7f\u3044\u5206\u3051\u308b\u3053\u3068\u3067\u52b9\u7387\u7684\u306a\u30e9\u30f3\u30c0\u30e0\u51e6\u7406\u304c\u53ef\u80fd\u306b\u306a\u308a\u307e\u3059\u3002\u3053\u306e\u8a18\u4e8b\u3067\u306f\u3001\u3053\u308c\u30893\u3064\u306e\u95a2\u6570\u306e\u9055\u3044\u304b\u3089\u5b9f\u7528\u7684\u306a\u5fdc\u7528\u4f8b\u307e\u3067\u3001\u8a73\u3057\u304f\u89e3\u8aac\u3057\u307e\u3059\u3002<\/p>\n\n<h2>1. 3\u3064\u306e\u95a2\u6570\u306e\u57fa\u672c\u7684\u306a\u9055\u3044<\/h2>\n<table>\n<thead>\n<tr>\n<th>\u95a2\u6570<\/th>\n<th>\u7528\u9014<\/th>\n<th>\u91cd\u8907<\/th>\n<th>\u5fa9\u5143\u62bd\u51fa<\/th>\n<th>\u91cd\u307f\u4ed8\u3051<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td><code>choice()<\/code><\/td>\n<td>1\u3064\u9078\u629e<\/td>\n<td>\u306a\u3057<\/td>\n<td>\u306a\u3057<\/td>\n<td>\u306a\u3057<\/td>\n<\/tr>\n<tr>\n<td><code>sample()<\/code><\/td>\n<td>\u8907\u6570\u9078\u629e<\/td>\n<td>\u306a\u3057<\/td>\n<td>\u306a\u3057<\/td>\n<td>\u306a\u3057<\/td>\n<\/tr>\n<tr>\n<td><code>choices()<\/code><\/td>\n<td>\u8907\u6570\u9078\u629e<\/td>\n<td>\u3042\u308a<\/td>\n<td>\u3042\u308a<\/td>\n<td>\u3042\u308a<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h2>2. random.choice() &#8211; 1\u3064\u306e\u8981\u7d20\u3092\u30e9\u30f3\u30c0\u30e0\u9078\u629e<\/h2>\n<h3>\u57fa\u672c\u7684\u306a\u4f7f\u3044\u65b9<\/h3>\n<pre><code class=\"language-python\">import random\n\nfruits = [\"apple\", \"banana\", \"orange\", \"grape\"]\nselected = random.choice(fruits)\nprint(selected)  # \"banana\"\uff08\u30e9\u30f3\u30c0\u30e0\u306b1\u3064\u9078\u629e\uff09\n<\/code><\/pre>\n<h3>\u6570\u5024\u30ea\u30b9\u30c8\u304b\u3089\u306e\u9078\u629e<\/h3>\n<pre><code class=\"language-python\">import random\n\nnumbers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]\nlucky_number = random.choice(numbers)\nprint(f\"\u30e9\u30c3\u30ad\u30fc\u30ca\u30f3\u30d0\u30fc: {lucky_number}\")\n<\/code><\/pre>\n<h3>\u6587\u5b57\u5217\u304b\u3089\u306e\u6587\u5b57\u9078\u629e<\/h3>\n<pre><code class=\"language-python\">import random\n\nalphabet = \"ABCDEFGHIJKLMNOPQRSTUVWXYZ\"\nrandom_char = random.choice(alphabet)\nprint(f\"\u30e9\u30f3\u30c0\u30e0\u6587\u5b57: {random_char}\")\n<\/code><\/pre>\n<h2>3. random.sample() &#8211; \u91cd\u8907\u306a\u3057\u3067\u8907\u6570\u9078\u629e<\/h2>\n<h3>\u57fa\u672c\u7684\u306a\u4f7f\u3044\u65b9<\/h3>\n<pre><code class=\"language-python\">import random\n\nnumbers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]\nselected = random.sample(numbers, 3)\nprint(selected)  # [7, 2, 9]\uff08\u91cd\u8907\u306a\u3057\u30673\u3064\u9078\u629e\uff09\n<\/code><\/pre>\n<h3>\u30d1\u30b9\u30ef\u30fc\u30c9\u751f\u6210\u3078\u306e\u5fdc\u7528<\/h3>\n<pre><code class=\"language-python\">import random\nimport string\n\ndef generate_password(length=8):\n    chars = string.ascii_letters + string.digits + \"!@#$%&amp;\"\n    return ''.join(random.sample(chars, length))\n\npassword = generate_password(12)\nprint(f\"\u751f\u6210\u3055\u308c\u305f\u30d1\u30b9\u30ef\u30fc\u30c9: {password}\")\n<\/code><\/pre>\n<h3>\u30ea\u30b9\u30c8\u5168\u4f53\u306e\u30b7\u30e3\u30c3\u30d5\u30eb<\/h3>\n<pre><code class=\"language-python\">import random\n\ndeck = [\"\u2660A\", \"\u2660K\", \"\u2660Q\", \"\u2660J\", \"\u266010\", \"\u2665A\", \"\u2665K\", \"\u2665Q\"]\nshuffled = random.sample(deck, len(deck))\nprint(f\"\u30b7\u30e3\u30c3\u30d5\u30eb\u5f8c: {shuffled}\")\n\n# random.shuffle()\u3068\u540c\u7b49\u3060\u304c\u65b0\u3057\u3044\u30ea\u30b9\u30c8\u3092\u8fd4\u3059\n<\/code><\/pre>\n<h2>4. random.choices() &#8211; \u91cd\u8907\u3042\u308a\u3067\u8907\u6570\u9078\u629e\uff08\u91cd\u307f\u4ed8\u3051\u53ef\u80fd\uff09<\/h2>\n<h3>\u57fa\u672c\u7684\u306a\u4f7f\u3044\u65b9<\/h3>\n<pre><code class=\"language-python\">import random\n\ncolors = [\"red\", \"blue\", \"green\", \"yellow\"]\nselected = random.choices(colors, k=5)\nprint(selected)  # ['blue', 'red', 'blue', 'green', 'red']\uff08\u91cd\u8907\u3042\u308a\uff09\n<\/code><\/pre>\n<h3>\u91cd\u307f\u4ed8\u3051\u3092\u4f7f\u3063\u305f\u9078\u629e<\/h3>\n<pre><code class=\"language-python\">import random\n\nitems = [\"Common\", \"Rare\", \"Epic\", \"Legendary\"]\nweights = [70, 20, 8, 2]  # \u78ba\u7387\u306e\u91cd\u307f\n\nresult = random.choices(items, weights=weights, k=10)\nprint(result)\n# Common\u304c\u591a\u304f\u9078\u3070\u308c\u3001Legendary\u306f\u7a00\u306b\u9078\u3070\u308c\u308b\n<\/code><\/pre>\n<h3>\u78ba\u7387\u5206\u5e03\u306b\u3088\u308b\u9078\u629e<\/h3>\n<pre><code class=\"language-python\">import random\n\n# \u30b5\u30a4\u30b3\u30ed\u306e\u51fa\u76ee\uff08\u91cd\u307f\u4ed8\u3051\uff09\ndice_faces = [1, 2, 3, 4, 5, 6]\n# \u901a\u5e38\u306e\u30b5\u30a4\u30b3\u30ed\uff08\u5747\u7b49\u78ba\u7387\uff09\nnormal_dice = random.choices(dice_faces, k=100)\n\n# \u3044\u304b\u3055\u307e\u30b5\u30a4\u30b3\u30ed\uff086\u304c\u51fa\u3084\u3059\u3044\uff09\nloaded_weights = [1, 1, 1, 1, 1, 5]\nloaded_dice = random.choices(dice_faces, weights=loaded_weights, k=100)\n\nprint(f\"6\u306e\u51fa\u73fe\u56de\u6570\uff08\u901a\u5e38\uff09: {normal_dice.count(6)}\")\nprint(f\"6\u306e\u51fa\u73fe\u56de\u6570\uff08\u3044\u304b\u3055\u307e\uff09: {loaded_dice.count(6)}\")\n<\/code><\/pre>\n<h2>5. \u5b9f\u7528\u7684\u306a\u5fdc\u7528\u4f8b<\/h2>\n<h3>\u30af\u30a4\u30ba\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3<\/h3>\n<pre><code class=\"language-python\">import random\n\nclass QuizApp:\n    def __init__(self):\n        self.questions = [\n            {\"q\": \"Python\u306e\u4f5c\u8005\u306f\uff1f\", \"a\": \"Guido van Rossum\"},\n            {\"q\": \"1 + 1 = ?\", \"a\": \"2\"},\n            {\"q\": \"\u65e5\u672c\u306e\u9996\u90fd\u306f\uff1f\", \"a\": \"\u6771\u4eac\"},\n            {\"q\": \"2\u306e3\u4e57\u306f\uff1f\", \"a\": \"8\"}\n        ]\n    \n    def get_random_question(self):\n        return random.choice(self.questions)\n    \n    def get_quiz_set(self, num_questions):\n        return random.sample(self.questions, min(num_questions, len(self.questions)))\n\nquiz = QuizApp()\nquestion = quiz.get_random_question()\nprint(f\"\u554f\u984c: {question['q']}\")\n\nquiz_set = quiz.get_quiz_set(2)\nfor i, q in enumerate(quiz_set, 1):\n    print(f\"{i}. {q['q']}\")\n<\/code><\/pre>\n<h3>\u30b2\u30fc\u30e0\u306e\u30a2\u30a4\u30c6\u30e0\u30c9\u30ed\u30c3\u30d7\u30b7\u30b9\u30c6\u30e0<\/h3>\n<pre><code class=\"language-python\">import random\n\nclass ItemDrop:\n    def __init__(self):\n        self.items = {\n            \"\u30dd\u30fc\u30b7\u30e7\u30f3\": {\"weight\": 50, \"rarity\": \"Common\"},\n            \"\u30de\u30b8\u30c3\u30af\u30bd\u30fc\u30c9\": {\"weight\": 20, \"rarity\": \"Rare\"},\n            \"\u30c9\u30e9\u30b4\u30f3\u30a2\u30fc\u30de\u30fc\": {\"weight\": 5, \"rarity\": \"Epic\"},\n            \"\u4f1d\u8aac\u306e\u6307\u8f2a\": {\"weight\": 1, \"rarity\": \"Legendary\"}\n        }\n    \n    def drop_items(self, num_drops=3):\n        item_names = list(self.items.keys())\n        weights = [self.items[item][\"weight\"] for item in item_names]\n        return random.choices(item_names, weights=weights, k=num_drops)\n\ndrop_system = ItemDrop()\ndropped = drop_system.drop_items(5)\nprint(f\"\u30c9\u30ed\u30c3\u30d7\u30a2\u30a4\u30c6\u30e0: {dropped}\")\n<\/code><\/pre>\n<h3>A\/B\u30c6\u30b9\u30c8\u306e\u30e6\u30fc\u30b6\u30fc\u632f\u308a\u5206\u3051<\/h3>\n<pre><code class=\"language-python\">import random\n\nclass ABTestAssigner:\n    def __init__(self, variant_weights=None):\n        self.variants = [\"A\", \"B\"]\n        self.weights = variant_weights or [50, 50]  # \u30c7\u30d5\u30a9\u30eb\u30c8\u306f50:50\n    \n    def assign_user(self, user_id):\n        # \u30e6\u30fc\u30b6\u30fcID\u3092\u30b7\u30fc\u30c9\u306b\u3057\u3066\u518d\u73fe\u53ef\u80fd\u306a\u632f\u308a\u5206\u3051\n        random.seed(user_id)\n        variant = random.choices(self.variants, weights=self.weights)[0]\n        random.seed()  # \u30b7\u30fc\u30c9\u3092\u30ea\u30bb\u30c3\u30c8\n        return variant\n    \n    def assign_multiple_users(self, user_ids):\n        return [self.assign_user(uid) for uid in user_ids]\n\n# 70:30\u306e\u6bd4\u7387\u3067\u30c6\u30b9\u30c8\nab_test = ABTestAssigner([70, 30])\nuser_ids = range(1, 101)\nassignments = ab_test.assign_multiple_users(user_ids)\n\nprint(f\"\u30b0\u30eb\u30fc\u30d7A\u306e\u4eba\u6570: {assignments.count('A')}\")\nprint(f\"\u30b0\u30eb\u30fc\u30d7B\u306e\u4eba\u6570: {assignments.count('B')}\")\n<\/code><\/pre>\n<h2>6. \u30c7\u30fc\u30bf\u30b5\u30f3\u30d7\u30ea\u30f3\u30b0\u3068\u7d71\u8a08\u51e6\u7406<\/h2>\n<h3>\u30c7\u30fc\u30bf\u30bb\u30c3\u30c8\u304b\u3089\u306e\u30e9\u30f3\u30c0\u30e0\u30b5\u30f3\u30d7\u30ea\u30f3\u30b0<\/h3>\n<pre><code class=\"language-python\">import random\n\ndef create_sample_dataset():\n    \"\"\"\u30b5\u30f3\u30d7\u30eb\u30c7\u30fc\u30bf\u30bb\u30c3\u30c8\u3092\u4f5c\u6210\"\"\"\n    data = []\n    for i in range(1000):\n        data.append({\n            \"id\": i,\n            \"age\": random.randint(18, 80),\n            \"income\": random.randint(200, 1000) * 1000,\n            \"category\": random.choice([\"A\", \"B\", \"C\"])\n        })\n    return data\n\ndef analyze_sample(dataset, sample_size=100):\n    \"\"\"\u30e9\u30f3\u30c0\u30e0\u30b5\u30f3\u30d7\u30eb\u3092\u5206\u6790\"\"\"\n    sample = random.sample(dataset, sample_size)\n    \n    avg_age = sum(person[\"age\"] for person in sample) \/ len(sample)\n    avg_income = sum(person[\"income\"] for person in sample) \/ len(sample)\n    \n    return {\n        \"sample_size\": len(sample),\n        \"average_age\": round(avg_age, 1),\n        \"average_income\": round(avg_income, 0)\n    }\n\ndataset = create_sample_dataset()\nanalysis = analyze_sample(dataset, 50)\nprint(f\"\u30b5\u30f3\u30d7\u30eb\u5206\u6790\u7d50\u679c: {analysis}\")\n<\/code><\/pre>\n<h3>\u91cd\u307f\u4ed8\u304d\u30e9\u30f3\u30c0\u30e0\u30b5\u30f3\u30d7\u30ea\u30f3\u30b0<\/h3>\n<pre><code class=\"language-python\">import random\n\ndef weighted_sampling(population, weights, k):\n    \"\"\"\u91cd\u307f\u4ed8\u304d\u30b5\u30f3\u30d7\u30ea\u30f3\u30b0\uff08\u5fa9\u5143\u62bd\u51fa\uff09\"\"\"\n    return random.choices(population, weights=weights, k=k)\n\ndef weighted_sampling_no_replacement(population, weights, k):\n    \"\"\"\u91cd\u307f\u4ed8\u304d\u30b5\u30f3\u30d7\u30ea\u30f3\u30b0\uff08\u975e\u5fa9\u5143\u62bd\u51fa\uff09\"\"\"\n    selected = []\n    pop_copy = population.copy()\n    weights_copy = weights.copy()\n    \n    for _ in range(min(k, len(pop_copy))):\n        chosen = random.choices(pop_copy, weights=weights_copy)[0]\n        idx = pop_copy.index(chosen)\n        selected.append(pop_copy.pop(idx))\n        weights_copy.pop(idx)\n    \n    return selected\n\n# \u4f7f\u7528\u4f8b\ncities = [\"\u6771\u4eac\", \"\u5927\u962a\", \"\u540d\u53e4\u5c4b\", \"\u798f\u5ca1\", \"\u672d\u5e4c\"]\npopulations = [1400, 880, 230, 160, 190]  # \u4eba\u53e3\uff08\u4e07\u4eba\uff09\n\n# \u4eba\u53e3\u306b\u6bd4\u4f8b\u3057\u305f\u91cd\u307f\u4ed8\u304d\u30b5\u30f3\u30d7\u30ea\u30f3\u30b0\nsample1 = weighted_sampling(cities, populations, 10)\nsample2 = weighted_sampling_no_replacement(cities, populations, 3)\n\nprint(f\"\u5fa9\u5143\u62bd\u51fa: {sample1}\")\nprint(f\"\u975e\u5fa9\u5143\u62bd\u51fa: {sample2}\")\n<\/code><\/pre>\n<h2>7. \u30b7\u30df\u30e5\u30ec\u30fc\u30b7\u30e7\u30f3\u5fdc\u7528<\/h2>\n<h3>\u30e2\u30f3\u30c6\u30ab\u30eb\u30ed\u30b7\u30df\u30e5\u30ec\u30fc\u30b7\u30e7\u30f3<\/h3>\n<pre><code class=\"language-python\">import random\nimport math\n\ndef estimate_pi(num_points=100000):\n    \"\"\"\u30e2\u30f3\u30c6\u30ab\u30eb\u30ed\u6cd5\u3067\u03c0\u3092\u63a8\u5b9a\"\"\"\n    inside_circle = 0\n    \n    for _ in range(num_points):\n        x = random.uniform(-1, 1)\n        y = random.uniform(-1, 1)\n        if x**2 + y**2 &lt;= 1:\n            inside_circle += 1\n    \n    return 4 * inside_circle \/ num_points\n\nestimated_pi = estimate_pi(1000000)\nprint(f\"\u63a8\u5b9a\u03c0\u5024: {estimated_pi}\")\nprint(f\"\u5b9f\u969b\u306e\u03c0\u5024: {math.pi}\")\nprint(f\"\u8aa4\u5dee: {abs(estimated_pi - math.pi):.6f}\")\n<\/code><\/pre>\n<h3>\u30e9\u30f3\u30c0\u30e0\u30a6\u30a9\u30fc\u30af<\/h3>\n<pre><code class=\"language-python\">import random\n\ndef random_walk_2d(steps=1000):\n    \"\"\"2\u6b21\u5143\u30e9\u30f3\u30c0\u30e0\u30a6\u30a9\u30fc\u30af\"\"\"\n    x, y = 0, 0\n    path = [(x, y)]\n    \n    directions = [(0, 1), (1, 0), (0, -1), (-1, 0)]  # \u4e0a\u3001\u53f3\u3001\u4e0b\u3001\u5de6\n    \n    for _ in range(steps):\n        dx, dy = random.choice(directions)\n        x += dx\n        y += dy\n        path.append((x, y))\n    \n    return path\n\ndef analyze_random_walk(path):\n    \"\"\"\u30e9\u30f3\u30c0\u30e0\u30a6\u30a9\u30fc\u30af\u306e\u5206\u6790\"\"\"\n    start = path[0]\n    end = path[-1]\n    max_distance = max(abs(x) + abs(y) for x, y in path)\n    \n    return {\n        \"start\": start,\n        \"end\": end,\n        \"final_distance\": abs(end[0]) + abs(end[1]),\n        \"max_distance\": max_distance\n    }\n\npath = random_walk_2d(10000)\nanalysis = analyze_random_walk(path)\nprint(f\"\u30e9\u30f3\u30c0\u30e0\u30a6\u30a9\u30fc\u30af\u5206\u6790: {analysis}\")\n<\/code><\/pre>\n<h2>8. \u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u6bd4\u8f03\u3068\u6700\u9069\u5316<\/h2>\n<h3>\u5b9f\u884c\u901f\u5ea6\u306e\u6bd4\u8f03<\/h3>\n<pre><code class=\"language-python\">import random\nimport time\n\ndef performance_test():\n    data = list(range(10000))\n    iterations = 10000\n    \n    # choice()\u306e\u30c6\u30b9\u30c8\n    start = time.time()\n    for _ in range(iterations):\n        random.choice(data)\n    choice_time = time.time() - start\n    \n    # sample()\u306e\u30c6\u30b9\u30c8\uff081\u500b\u9078\u629e\uff09\n    start = time.time()\n    for _ in range(iterations):\n        random.sample(data, 1)\n    sample_time = time.time() - start\n    \n    # choices()\u306e\u30c6\u30b9\u30c8\uff081\u500b\u9078\u629e\uff09\n    start = time.time()\n    for _ in range(iterations):\n        random.choices(data, k=1)\n    choices_time = time.time() - start\n    \n    print(f\"choice(): {choice_time:.4f}\u79d2\")\n    print(f\"sample(): {sample_time:.4f}\u79d2\")\n    print(f\"choices(): {choices_time:.4f}\u79d2\")\n\nperformance_test()\n<\/code><\/pre>\n<h3>\u30e1\u30e2\u30ea\u52b9\u7387\u7684\u306a\u5927\u898f\u6a21\u30b5\u30f3\u30d7\u30ea\u30f3\u30b0<\/h3>\n<pre><code class=\"language-python\">import random\n\ndef efficient_large_sampling(data_generator, sample_size):\n    \"\"\"\u5927\u898f\u6a21\u30c7\u30fc\u30bf\u304b\u3089\u306e\u52b9\u7387\u7684\u30b5\u30f3\u30d7\u30ea\u30f3\u30b0\uff08\u30ea\u30b6\u30fc\u30d0\u30fc\u30b5\u30f3\u30d7\u30ea\u30f3\u30b0\uff09\"\"\"\n    reservoir = []\n    \n    for i, item in enumerate(data_generator()):\n        if len(reservoir) &lt; sample_size:\n            reservoir.append(item)\n        else:\n            # \u30e9\u30f3\u30c0\u30e0\u306b\u7f6e\u304d\u63db\u3048\n            j = random.randint(0, i)\n            if j &lt; sample_size:\n                reservoir[j] = item\n    \n    return reservoir\n\ndef large_data_generator():\n    \"\"\"\u5927\u91cf\u30c7\u30fc\u30bf\u306e\u30b8\u30a7\u30cd\u30ec\u30fc\u30bf\"\"\"\n    for i in range(1000000):\n        yield f\"data_{i}\"\n\n# 100\u4e07\u4ef6\u306e\u30c7\u30fc\u30bf\u304b\u30891000\u4ef6\u3092\u30b5\u30f3\u30d7\u30ea\u30f3\u30b0\nsample = efficient_large_sampling(large_data_generator, 1000)\nprint(f\"\u30b5\u30f3\u30d7\u30eb\u30b5\u30a4\u30ba: {len(sample)}\")\nprint(f\"\u6700\u521d\u306e5\u4ef6: {sample[:5]}\")\n<\/code><\/pre>\n<h2>9. \u30a8\u30e9\u30fc\u30cf\u30f3\u30c9\u30ea\u30f3\u30b0\u3068\u30d9\u30b9\u30c8\u30d7\u30e9\u30af\u30c6\u30a3\u30b9<\/h2>\n<h3>\u5b89\u5168\u306a\u9078\u629e\u95a2\u6570<\/h3>\n<pre><code class=\"language-python\">import random\n\ndef safe_choice(sequence, default=None):\n    \"\"\"\u7a7a\u306e\u30b7\u30fc\u30b1\u30f3\u30b9\u3067\u3082\u30a8\u30e9\u30fc\u306b\u306a\u3089\u306a\u3044choice\"\"\"\n    try:\n        return random.choice(sequence)\n    except IndexError:\n        return default\n\ndef safe_sample(sequence, k, default=None):\n    \"\"\"\u8981\u6c42\u6570\u304c\u30b7\u30fc\u30b1\u30f3\u30b9\u9577\u3092\u8d85\u3048\u3066\u3082\u30a8\u30e9\u30fc\u306b\u306a\u3089\u306a\u3044sample\"\"\"\n    try:\n        return random.sample(sequence, k)\n    except ValueError:\n        return default or sequence.copy() if sequence else []\n\ndef safe_choices(sequence, k=1, weights=None, default=None):\n    \"\"\"\u7a7a\u306e\u30b7\u30fc\u30b1\u30f3\u30b9\u3067\u3082\u30a8\u30e9\u30fc\u306b\u306a\u3089\u306a\u3044choices\"\"\"\n    if not sequence:\n        return default or []\n    \n    try:\n        return random.choices(sequence, weights=weights, k=k)\n    except (ValueError, TypeError):\n        return default or []\n\n# \u4f7f\u7528\u4f8b\nempty_list = []\nshort_list = [1, 2]\n\nprint(safe_choice(empty_list, \"\u30c7\u30d5\u30a9\u30eb\u30c8\u5024\"))  # \u30c7\u30d5\u30a9\u30eb\u30c8\u5024\nprint(safe_sample(short_list, 5))  # [1, 2]\uff08\u5168\u8981\u7d20\u8fd4\u5374\uff09\nprint(safe_choices(empty_list, k=3, default=[\"\u306a\u3057\"]))  # [\"\u306a\u3057\"]\n<\/code><\/pre>\n<h2>10. \u5b9f\u8df5\u7684\u306a\u30e6\u30fc\u30b9\u30b1\u30fc\u30b9<\/h2>\n<h3>\u6a5f\u68b0\u5b66\u7fd2\u306e\u30c7\u30fc\u30bf\u5206\u5272<\/h3>\n<pre><code class=\"language-python\">import random\n\ndef train_test_split(data, test_ratio=0.2, random_state=None):\n    \"\"\"\u30c7\u30fc\u30bf\u3092\u8a13\u7df4\u7528\u3068\u30c6\u30b9\u30c8\u7528\u306b\u5206\u5272\"\"\"\n    if random_state:\n        random.seed(random_state)\n    \n    data_copy = data.copy()\n    random.shuffle(data_copy)\n    \n    split_point = int(len(data_copy) * (1 - test_ratio))\n    train_data = data_copy[:split_point]\n    test_data = data_copy[split_point:]\n    \n    return train_data, test_data\n\n# \u30b5\u30f3\u30d7\u30eb\u30c7\u30fc\u30bf\ndataset = [{\"features\": [i, i*2], \"label\": i % 2} for i in range(100)]\n\ntrain, test = train_test_split(dataset, test_ratio=0.3, random_state=42)\nprint(f\"\u8a13\u7df4\u30c7\u30fc\u30bf: {len(train)}\u4ef6\")\nprint(f\"\u30c6\u30b9\u30c8\u30c7\u30fc\u30bf: {len(test)}\u4ef6\")\n<\/code><\/pre>\n<h3>\u30ed\u30fc\u30c9\u30d0\u30e9\u30f3\u30b5\u30fc\u306e\u5b9f\u88c5<\/h3>\n<pre><code class=\"language-python\">import random\n\nclass LoadBalancer:\n    def __init__(self, servers, weights=None):\n        self.servers = servers\n        self.weights = weights or [1] * len(servers)\n    \n    def get_server_random(self):\n        \"\"\"\u30e9\u30f3\u30c0\u30e0\u9078\u629e\"\"\"\n        return random.choice(self.servers)\n    \n    def get_server_weighted(self):\n        \"\"\"\u91cd\u307f\u4ed8\u304d\u9078\u629e\"\"\"\n        return random.choices(self.servers, weights=self.weights)[0]\n    \n    def get_servers_batch(self, count):\n        \"\"\"\u30d0\u30c3\u30c1\u51e6\u7406\u7528\u306e\u8907\u6570\u30b5\u30fc\u30d0\u30fc\u9078\u629e\"\"\"\n        return random.choices(self.servers, weights=self.weights, k=count)\n\n# \u4f7f\u7528\u4f8b\nservers = [\"server1\", \"server2\", \"server3\", \"server4\"]\nweights = [4, 3, 2, 1]  # server1\u304c\u6700\u3082\u9ad8\u6027\u80fd\n\nlb = LoadBalancer(servers, weights)\n\nprint(\"\u30e9\u30f3\u30c0\u30e0\u9078\u629e:\")\nfor _ in range(5):\n    print(f\"  -&gt; {lb.get_server_random()}\")\n\nprint(\"\\n\u91cd\u307f\u4ed8\u304d\u9078\u629e:\")\nfor _ in range(5):\n    print(f\"  -&gt; {lb.get_server_weighted()}\")\n<\/code><\/pre>\n<h2>\u307e\u3068\u3081<\/h2>\n<p>Python \u306e <code>random.choice()<\/code>\u3001<code>random.sample()<\/code>\u3001<code>random.choices()<\/code> \u306f\u3001\u305d\u308c\u305e\u308c\u7570\u306a\u308b\u7279\u5fb4\u3092\u6301\u3064\u5f37\u529b\u306a\u95a2\u6570\u3067\u3059\uff1a<\/p>\n<ul>\n<li><strong>choice()<\/strong>: 1\u3064\u306e\u8981\u7d20\u3092\u30b7\u30f3\u30d7\u30eb\u306b\u9078\u629e\u3057\u305f\u3044\u5834\u5408<\/li>\n<li><strong>sample()<\/strong>: \u91cd\u8907\u306a\u3057\u3067\u8907\u6570\u306e\u8981\u7d20\u3092\u9078\u629e\u3057\u305f\u3044\u5834\u5408<\/li>\n<li><strong>choices()<\/strong>: \u91cd\u8907\u3042\u308a\u3067\u8907\u6570\u9078\u629e\u3001\u307e\u305f\u306f\u91cd\u307f\u4ed8\u3051\u9078\u629e\u304c\u5fc5\u8981\u306a\u5834\u5408<\/li>\n<\/ul>\n<p>\u9069\u5207\u306a\u95a2\u6570\u3092\u9078\u629e\u3059\u308b\u3053\u3068\u3067\u3001\u52b9\u7387\u7684\u3067\u8aad\u307f\u3084\u3059\u3044\u30b3\u30fc\u30c9\u3092\u66f8\u304f\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002\u307e\u305f\u3001\u30a8\u30e9\u30fc\u30cf\u30f3\u30c9\u30ea\u30f3\u30b0\u3084\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u3082\u8003\u616e\u3057\u3066\u3001\u5805\u7262\u306a\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u69cb\u7bc9\u3057\u307e\u3057\u3087\u3046\u3002<\/p>\n<p>\u3053\u308c\u3089\u306e\u95a2\u6570\u3092\u30de\u30b9\u30bf\u30fc\u3059\u308b\u3053\u3068\u3067\u3001\u30b7\u30df\u30e5\u30ec\u30fc\u30b7\u30e7\u30f3\u3001\u30b2\u30fc\u30e0\u958b\u767a\u3001\u30c7\u30fc\u30bf\u5206\u6790\u3001\u6a5f\u68b0\u5b66\u7fd2\u306a\u3069\u3001\u69d8\u3005\u306a\u5206\u91ce\u3067\u30e9\u30f3\u30c0\u30e0\u51e6\u7406\u3092\u52b9\u679c\u7684\u306b\u6d3b\u7528\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u25a0<a href=\"https:\/\/amzn.to\/3VxGkpx\">\u3089\u304f\u3089\u304fPython\u587e &#8211; \u8aad\u3080\u3060\u3051\u3067\u30de\u30b9\u30bf\u30fc<\/a><\/h2>\n\n\n\n<p><iframe loading=\"lazy\" width=\"560\" height=\"314\" src=\"\/\/www.youtube.com\/embed\/7iX9nAJE0cE\" allowfullscreen=\"allowfullscreen\"><\/iframe><\/p>\n\n\n\n<p>\u25a0\u30d7\u30ed\u30f3\u30d7\u30c8\u3060\u3051\u3067\u30aa\u30ea\u30b8\u30ca\u30eb\u30a2\u30d7\u30ea\u3092\u958b\u767a\u30fb\u516c\u958b\u3057\u3066\u307f\u305f\uff01\uff01<\/p>\n\n\n\n<figure class=\"wp-block-embed is-type-wp-embed\"><div class=\"wp-block-embed__wrapper\">\n<blockquote class=\"wp-embedded-content\" data-secret=\"MZg2nEnGip\"><a href=\"https:\/\/techgym.jp\/column\/ori-app\/\">\u30d7\u30ed\u30f3\u30d7\u30c8\u3060\u3051\u3067\u30aa\u30ea\u30b8\u30ca\u30eb\u30a2\u30d7\u30ea\u3092\u958b\u767a\u30fb\u516c\u958b\u3057\u3066\u307f\u305f\uff01\uff01<\/a><\/blockquote><iframe loading=\"lazy\" class=\"wp-embedded-content\" sandbox=\"allow-scripts\" security=\"restricted\" style=\"position: absolute; visibility: hidden;\" title=\"&#8220;\u30d7\u30ed\u30f3\u30d7\u30c8\u3060\u3051\u3067\u30aa\u30ea\u30b8\u30ca\u30eb\u30a2\u30d7\u30ea\u3092\u958b\u767a\u30fb\u516c\u958b\u3057\u3066\u307f\u305f\uff01\uff01&#8221; &#8212; \u3010\u30c6\u30c3\u30af\u30b8\u30e0\u3011\u683c\u5b89\u30fb\u5bfe\u9762\u578b\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u30b9\u30af\u30fc\u30eb\" src=\"https:\/\/techgym.jp\/column\/ori-app\/embed\/#?secret=5KLt97SggV#?secret=MZg2nEnGip\" data-secret=\"MZg2nEnGip\" width=\"600\" height=\"338\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\"><\/iframe>\n<\/div><\/figure>\n\n\n\n<p>\u25a0AI\u6642\u4ee3\u306e\u7b2c\u4e00\u6b69\uff01\u300cAI\u99c6\u52d5\u958b\u767a\u30b3\u30fc\u30b9\u300d\u306f\u3058\u3081\u307e\u3057\u305f\uff01<\/p>\n\n\n\n<p>\u30c6\u30c3\u30af\u30b8\u30e0\u6771\u4eac\u672c\u6821\u3067\u5148\u884c\u958b\u59cb\u3002<\/p>\n\n\n\n<figure class=\"wp-block-embed is-type-wp-embed\"><div class=\"wp-block-embed__wrapper\">\n<blockquote class=\"wp-embedded-content\" data-secret=\"zF3abQdMdK\"><a href=\"https:\/\/techgym.jp\/about\/ai-driven-development\/\">AI\u99c6\u52d5\u958b\u767a\/\u751f\u6210AI\u30a8\u30f3\u30b8\u30cb\u30a2\u30b3\u30fc\u30b9\uff08\u521d\u5fc3\u8005\u5411\u3051\uff09<\/a><\/blockquote><iframe loading=\"lazy\" class=\"wp-embedded-content\" sandbox=\"allow-scripts\" security=\"restricted\" style=\"position: absolute; visibility: hidden;\" title=\"&#8220;AI\u99c6\u52d5\u958b\u767a\/\u751f\u6210AI\u30a8\u30f3\u30b8\u30cb\u30a2\u30b3\u30fc\u30b9\uff08\u521d\u5fc3\u8005\u5411\u3051\uff09&#8221; &#8212; \u3010\u30c6\u30c3\u30af\u30b8\u30e0\u3011\u683c\u5b89\u30fb\u5bfe\u9762\u578b\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u30b9\u30af\u30fc\u30eb\" src=\"https:\/\/techgym.jp\/about\/ai-driven-development\/embed\/#?secret=eJ01zQgrR5#?secret=zF3abQdMdK\" data-secret=\"zF3abQdMdK\" width=\"600\" height=\"338\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\"><\/iframe>\n<\/div><\/figure>\n\n\n\n<p>\u25a0\u30c6\u30c3\u30af\u30b8\u30e0\u6771\u4eac\u672c\u6821<\/p>\n\n\n\n<p>\u300c\u6b66\u7530\u587e\u300d\u306e\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u7248\u3068\u3044\u3048\u3070\u300c\u30c6\u30c3\u30af\u30b8\u30e0\u300d\u3002<br>\u8b1b\u7fa9\u52d5\u753b\u306a\u3057\u3001\u6559\u79d1\u66f8\u306a\u3057\u3002\u300c\u9032\u6357\u7ba1\u7406\u3068\u30b3\u30fc\u30c1\u30f3\u30b0\u300d\u3067\u52b9\u7387\u5b66\u7fd2\u3002<br>\u3088\u308a\u65e9\u304f\u3001\u3088\u308a\u5b89\u304f\u3001\u3057\u304b\u3082\u5bfe\u9762\u578b\u306e\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u30b9\u30af\u30fc\u30eb\u3067\u3059\u3002<\/p>\n\n\n\n<figure class=\"wp-block-embed is-type-wp-embed\"><div class=\"wp-block-embed__wrapper\">\n<blockquote class=\"wp-embedded-content\" data-secret=\"1Vo2c08cvq\"><a href=\"https:\/\/techgym.jp\/tokyo\/tokyo_honko\/\">\u30c6\u30c3\u30af\u30b8\u30e0\u6771\u4eac\u672c\u6821<\/a><\/blockquote><iframe loading=\"lazy\" class=\"wp-embedded-content\" sandbox=\"allow-scripts\" security=\"restricted\" style=\"position: absolute; visibility: hidden;\" title=\"&#8220;\u30c6\u30c3\u30af\u30b8\u30e0\u6771\u4eac\u672c\u6821&#8221; &#8212; \u3010\u30c6\u30c3\u30af\u30b8\u30e0\u3011\u683c\u5b89\u30fb\u5bfe\u9762\u578b\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u30b9\u30af\u30fc\u30eb\" src=\"https:\/\/techgym.jp\/tokyo\/tokyo_honko\/embed\/#?secret=trSxGpJ0B2#?secret=1Vo2c08cvq\" data-secret=\"1Vo2c08cvq\" width=\"600\" height=\"338\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\"><\/iframe>\n<\/div><\/figure>\n\n\n\n<p>\uff1c\u77ed\u671f\u8b1b\u7fd2\uff1e5\u65e5\u30675\u4e07\u5186\u306e\u300cPython\u30df\u30cb\u30ad\u30e3\u30f3\u30d7\u300d\u958b\u50ac\u4e2d\u3002<\/p>\n\n\n\n<figure class=\"wp-block-embed is-type-wp-embed\"><div class=\"wp-block-embed__wrapper\">\n<blockquote class=\"wp-embedded-content\" data-secret=\"dPLkRhoWBS\"><a href=\"https:\/\/techgym.jp\/event\/nagatacho_camp\/\">\u3010\u6700\u901f\u30fb\u78ba\u5b9f\u3011\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u653b\u7565\u300c\u6c38\u7530\u753aPython\u30df\u30cb\u30ad\u30e3\u30f3\u30d7\u300d\u30105\u65e5\u9593\u30675\u4e07\u5186\u3011<\/a><\/blockquote><iframe loading=\"lazy\" class=\"wp-embedded-content\" sandbox=\"allow-scripts\" security=\"restricted\" style=\"position: absolute; visibility: hidden;\" title=\"&#8220;\u3010\u6700\u901f\u30fb\u78ba\u5b9f\u3011\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u653b\u7565\u300c\u6c38\u7530\u753aPython\u30df\u30cb\u30ad\u30e3\u30f3\u30d7\u300d\u30105\u65e5\u9593\u30675\u4e07\u5186\u3011&#8221; &#8212; \u3010\u30c6\u30c3\u30af\u30b8\u30e0\u3011\u683c\u5b89\u30fb\u5bfe\u9762\u578b\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u30b9\u30af\u30fc\u30eb\" src=\"https:\/\/techgym.jp\/event\/nagatacho_camp\/embed\/#?secret=yI8V58yvEb#?secret=dPLkRhoWBS\" data-secret=\"dPLkRhoWBS\" width=\"600\" height=\"338\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\"><\/iframe>\n<\/div><\/figure>\n\n\n\n<p>\uff1c\u67081\u958b\u50ac\uff1e\u653e\u9001\u4f5c\u5bb6\u306b\u3088\u308b\u6620\u50cf\u30c7\u30a3\u30ec\u30af\u30bf\u30fc\u990a\u6210\u8b1b\u5ea7<\/p>\n\n\n\n<figure class=\"wp-block-embed is-type-wp-embed\"><div class=\"wp-block-embed__wrapper\">\n<blockquote class=\"wp-embedded-content\" data-secret=\"SSx4t6Eexu\"><a href=\"https:\/\/techgym.jp\/event\/video_director\/\">\u73fe\u5f79\u653e\u9001\u4f5c\u5bb6\u304c\u6559\u3048\u308b\u52d5\u753b\u8b1b\u5ea7\uff01\u300e\uff24\uff2f\uff27\uff21\u300f<\/a><\/blockquote><iframe loading=\"lazy\" class=\"wp-embedded-content\" sandbox=\"allow-scripts\" security=\"restricted\" style=\"position: absolute; visibility: hidden;\" title=\"&#8220;\u73fe\u5f79\u653e\u9001\u4f5c\u5bb6\u304c\u6559\u3048\u308b\u52d5\u753b\u8b1b\u5ea7\uff01\u300e\uff24\uff2f\uff27\uff21\u300f&#8221; &#8212; \u3010\u30c6\u30c3\u30af\u30b8\u30e0\u3011\u683c\u5b89\u30fb\u5bfe\u9762\u578b\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u30b9\u30af\u30fc\u30eb\" src=\"https:\/\/techgym.jp\/event\/video_director\/embed\/#?secret=bSX68rzswL#?secret=SSx4t6Eexu\" data-secret=\"SSx4t6Eexu\" width=\"600\" height=\"338\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\"><\/iframe>\n<\/div><\/figure>\n\n\n\n<p>\uff1c\u30aa\u30f3\u30e9\u30a4\u30f3\u7121\u6599\uff1e\u30bc\u30ed\u304b\u3089\u59cb\u3081\u308bPython\u7206\u901f\u8b1b\u5ea7<\/p>\n\n\n\n<figure class=\"wp-block-embed is-type-wp-embed\"><div class=\"wp-block-embed__wrapper\">\n<blockquote class=\"wp-embedded-content\" data-secret=\"hnifDyHpQr\"><a href=\"https:\/\/techgym.jp\/tokyo_python\/\">\u3010\u7121\u6599\u30fb\u30aa\u30f3\u30e9\u30a4\u30f3\u3011\u30bc\u30ed\u304b\u3089\u306f\u3058\u3081\u308bPython\u7206\u901f\u8b1b\u5ea7<\/a><\/blockquote><iframe loading=\"lazy\" class=\"wp-embedded-content\" sandbox=\"allow-scripts\" security=\"restricted\" style=\"position: absolute; visibility: hidden;\" title=\"&#8220;\u3010\u7121\u6599\u30fb\u30aa\u30f3\u30e9\u30a4\u30f3\u3011\u30bc\u30ed\u304b\u3089\u306f\u3058\u3081\u308bPython\u7206\u901f\u8b1b\u5ea7&#8221; &#8212; \u3010\u30c6\u30c3\u30af\u30b8\u30e0\u3011\u683c\u5b89\u30fb\u5bfe\u9762\u578b\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u30b9\u30af\u30fc\u30eb\" src=\"https:\/\/techgym.jp\/tokyo_python\/embed\/#?secret=oWt3pCsbOm#?secret=hnifDyHpQr\" data-secret=\"hnifDyHpQr\" width=\"600\" height=\"338\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\"><\/iframe>\n<\/div><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>Python\u306erandom\u30e2\u30b8\u30e5\u30fc\u30eb\u306b\u306f\u3001\u30ea\u30b9\u30c8\u3084\u914d\u5217\u304b\u3089\u30e9\u30f3\u30c0\u30e0\u306b\u8981\u7d20\u3092\u9078\u629e\u3059\u308b\u305f\u3081\u306e3\u3064\u306e\u4e3b\u8981\u306a\u95a2\u6570\u304c\u3042\u308a\u307e\u3059\uff1achoice()\u3001sample()\u3001choices()\u3002\u305d\u308c\u305e\u308c\u7570\u306a\u308b\u7279\u5fb4\u3068\u7528\u9014\u3092\u6301\u3061\u3001\u9069\u5207\u306b\u4f7f\u3044\u5206\u3051\u308b [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":42501,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[5],"tags":[],"class_list":["post-43864","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-column"],"views":155,"jetpack_featured_media_url":"\/wp-content\/uploads\/2025\/07\/f3403acf5c65aedec0dba821c4c26404.png","jetpack_sharing_enabled":true,"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/techgym.jp\/wp-json\/wp\/v2\/posts\/43864","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/techgym.jp\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/techgym.jp\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/techgym.jp\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/techgym.jp\/wp-json\/wp\/v2\/comments?post=43864"}],"version-history":[{"count":0,"href":"https:\/\/techgym.jp\/wp-json\/wp\/v2\/posts\/43864\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/techgym.jp\/wp-json\/wp\/v2\/media\/42501"}],"wp:attachment":[{"href":"https:\/\/techgym.jp\/wp-json\/wp\/v2\/media?parent=43864"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/techgym.jp\/wp-json\/wp\/v2\/categories?post=43864"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/techgym.jp\/wp-json\/wp\/v2\/tags?post=43864"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}