Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
GameplayKit, GKRandomSource, GKRandomDistribution
Search
kichikuchi
October 23, 2015
Programming
1
270
GameplayKit, GKRandomSource, GKRandomDistribution
shibuya.swift #1 発表資料
kichikuchi
October 23, 2015
Tweet
Share
More Decks by kichikuchi
See All by kichikuchi
swiftにおける遅延評価
kichikuchi
0
2.8k
tableViewとcoolectionviewのパフォーマンスチューニング
kichikuchi
1
560
AB Tests in Mobile App
kichikuchi
1
1.9k
Other Decks in Programming
See All in Programming
今年のアップデートで振り返るCDKセキュリティのシフトレフト/2024-cdk-security-shift-left
tomoki10
0
360
快速入門可觀測性
blueswen
0
500
Simple組み合わせ村から大都会Railsにやってきた俺は / Coming to Rails from the Simple
moznion
3
2.1k
ATDDで素早く安定した デリバリを実現しよう!
tonnsama
1
1.8k
ASP.NET Core の OpenAPIサポート
h455h1
0
110
見えないメモリを観測する: PHP 8.4 `pg_result_memory_size()` とSQL結果のメモリ管理
kentaroutakeda
0
930
functionalなアプローチで動的要素を排除する
ryopeko
1
200
PHPで作るWebSocketサーバー ~リアクティブなアプリケーションを知るために~ / WebSocket Server in PHP - To know reactive applications
seike460
PRO
2
770
Amazon Nova Reelの可能性
hideg
0
200
KMP와 kotlinx.rpc로 서버와 클라이언트 동기화
kwakeuijin
0
300
PHPUnitしか使ってこなかった 一般PHPerがPestに乗り換えた実録
mashirou1234
0
420
Lookerは可視化だけじゃない。UIコンポーネントもあるんだ!
ymd65536
1
130
Featured
See All Featured
The Art of Programming - Codeland 2020
erikaheidi
53
13k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
356
29k
Building Better People: How to give real-time feedback that sticks.
wjessup
366
19k
Build The Right Thing And Hit Your Dates
maggiecrowley
33
2.5k
Raft: Consensus for Rubyists
vanstee
137
6.7k
Why Our Code Smells
bkeepers
PRO
335
57k
Writing Fast Ruby
sferik
628
61k
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
8
1.2k
jQuery: Nuts, Bolts and Bling
dougneiner
62
7.6k
Scaling GitHub
holman
459
140k
Learning to Love Humans: Emotional Interface Design
aarron
274
40k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
28
4.5k
Transcript
(BNFQMBZ,JUͷհ !LJDIJLVDIJ TIJCVZBTXJGU
ࣗݾհ w ٠ل ,B[VOPSJ,JLVDIJ w !LJDIJLVDIJ w J04ΤϯδχΞ w
(.0ϖύϘɿNJOOFνʔϜ w 0CKFDUJWF$ྺɿͱ
(BNFQMBZ,JUͷલʹ w 4QSJUF,JU w J04Ҏ্ʹରԠ͢ΔήʔϜ։ൃ༻ϑϨʔϜϫʔΫ w εϓϥΠτʹΞχϝʔγϣϯΛઃఆ w ཧγϛϡϨʔγϣϯʹΑΔিಥͷ࠶ݱ w
ήʔϜͷΞχϝʔγϣϯ෦Λ୲
(BNFQMBZ,JUͱ w J04͔ΒՃ͞ΕͨήʔϜͷγεςϜ෦ͷجຊ ػೳΛఏڙͯ͘͠ΕΔϑϨʔϜϫʔΫ w ήʔϜͷγεςϜ෦Λ୲
(BNFQMBZ,JUͷΫϥε w ͍͔ͭ͘ϐοΫΞοϓ ৄ͘͠SFGΛࢀর w (,3BOEPN4PVSDF w (,3BOEPN%JTUSJCVUJPO w (,.JONBY4USBUFHJTU
w (,(SBQI w (,"HFOU w (,3VMF4ZTUFN
(BNFQMBZ,JUͷΫϥε w ͍͔ͭ͘ϐοΫΞοϓ ৄ͘͠SFGΛࢀর w (,3BOEPN4PVSDF w (,3BOEPN%JTUSJCVUJPO w (,.JONBY4USBUFHJTU
w (,(SBQI w (,"HFOU w (,3VMF4ZTUFN
(,3BOEPN4PVSDF w ཚΛੜ͢Δ let rundomNumber = GKRandomSource.sharedRandom().nextInt() let rundomNumber2
= GKRandomSource.sharedRandom().nextIntWithUpperBound(6) < d > <d> w ཚੜͷΞϧΰϦζϜ w "3$
༷ʑͳੜํ๏ w (,"3$3BOEPN4PVSDF w ໌ࣔతʹTFFEΛ༩͑ͯཚΛੜ͢Δ let rundomNumber = GKARC4RandomSource.init(seed:
data).nextInt() w ผΞϧΰϦζϜͰཚΛੜ w (,-JOFBS$POHSVFOUJBM3BOEPN4PVSDF w )JHI1FSGPSNBODF -PX3BOEPNOFTT w (,.FSTFOOF5XJTUFS3BOEPN4PVSDF w )JHI3BOEPNOFTT -PX1FSGPSNBODF
ྻͷγϟοϑϧ let numbers = [Int](1...100) let shuffledNumbers = GKRandomSource.sharedRandom().arrayByShufflingObjectsInArray(number
s)
(,3BOEPN%JTUSJCVUJPO w ಛఆͷ֬ʹجͮ͘ཚΛੜͰ͖Δ w (,(BVTTJBO%JTUSJCVUJPO w (,4IV⒐FE%JTUSJCVUJPO let diceNumber
= GKRandomDistribution.d6().nextInt() let asakusaLine = GKRandomDistribution.d20().nextInt() let original = GKRandomDistribution(randomSource: GKMersenneTwisterRandomSource(), lowestValue: 10, highestValue: 20).nextInt() <d> <d> <d>
(,(BVTTJBO%JTUSJCVUJPO w ਖ਼نʹجͮ͘ཚΛੜ for (var i = 0; i
< 10000; i++) { print(GKGaussianDistribution.d20().nextInt()) }
(,4IV⒐FE%JTUSJCVUJPO w ࢦఆ͞ΕͨൣғͷࣈΛ̍ճͮͭબ͢Δ for (var i = 0; i
< 10000; i++) { print(GKShuffledDistribution.d20().nextInt()) }
ཚͷҰ୴ऴΘΓʂ
͕͜͜Πέͯͳ͍Αʂ w 0CKFDUJWF$ͷΈͰར༻Մೳͳϝιου͕ଟ
͕͜͜Πέͯͳ͍Αʂʂ w 0CKFDUJWF$ w ϝιουɿݸ w 4XJGU w ϝιουɿݸ
·ͱΊ w (BNFQMBZ,JU֓ཁ w ήʔϜγεςϜ෦ͷ࡞ʹศརͳػೳΛଟఏ ڙͯ͘͠ΕΔ w (,3BOEPN΄ʹΌΒΒ w ༷ʑͳཚΛखܰʹੜ
w ήʔϜҎ֎Ͱར༻Մೳʂ w 0CKFDUJWF$ͷΈར༻Մೳͳϝιου͕ଟ