Я пытаюсь рандомизировать появление персонажей в игре, но использовать их имя в качестве семени. Так что, если вы когда-нибудь встретите «Боба» в игре, он всегда будет иметь одинаковые волосы и глаза и т. Д.Как сгладить случайное распределение?
Сейчас я просто создаю номер из их имени (добавив все коды символов) и затем используя модуль, чтобы решить, какие у них есть варианты.
Пример: Семена Боба 276 (66 + 111 + 98). 276% количество причесок (40) приводит к 36.
Это работает отлично, но для списка 350+ имен, распределение выглядит следующим образом:
hair style: 0/# of people using it: 15
hair style: 1/# of people using it: 8
hair style: 2/# of people using it: 4
hair style: 3/# of people using it: 5
hair style: 4/# of people using it: 7
hair style: 5/# of people using it: 5
hair style: 6/# of people using it: 7
hair style: 7/# of people using it: 14
hair style: 8/# of people using it: 12
hair style: 9/# of people using it: 6
hair style: 10/# of people using it: 7
hair style: 11/# of people using it: 2
hair style: 12/# of people using it: 7
hair style: 13/# of people using it: 10
hair style: 14/# of people using it: 11
hair style: 15/# of people using it: 7
hair style: 16/# of people using it: 12
hair style: 17/# of people using it: 7
hair style: 18/# of people using it: 6
hair style: 19/# of people using it: 10
hair style: 20/# of people using it: 5
hair style: 21/# of people using it: 10
hair style: 22/# of people using it: 11
hair style: 23/# of people using it: 3
hair style: 24/# of people using it: 6
hair style: 25/# of people using it: 8
hair style: 26/# of people using it: 5
hair style: 27/# of people using it: 11
hair style: 28/# of people using it: 10
hair style: 29/# of people using it: 6
hair style: 30/# of people using it: 13
hair style: 31/# of people using it: 11
hair style: 32/# of people using it: 10
hair style: 33/# of people using it: 12
hair style: 34/# of people using it: 3
hair style: 35/# of people using it: 11
hair style: 36/# of people using it: 9
hair style: 37/# of people using it: 4
hair style: 38/# of people using it: 10
hair style: 39/# of people using it: 15
распределение не очень гладко , это повсюду (неудивительно). Я собираюсь столкнуться с множеством людей с прической № 0 и рядом с кем-то с прической № 11.
Как это можно сгладить?
Вы можете добавить стили волос, чтобы сделать количество причесок быть простым? –
У вас должны быть люди с тем же именем, имеющие одну и ту же прическу? Или он гибкий, пока вы можете найти способ сгладить распределение? – Calpis