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
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
kichikuchi
October 23, 2015
Programming
290
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
GameplayKit, GKRandomSource, GKRandomDistribution
shibuya.swift #1 発表資料
kichikuchi
October 23, 2015
More Decks by kichikuchi
See All by kichikuchi
swiftにおける遅延評価
kichikuchi
0
3k
tableViewとcoolectionviewのパフォーマンスチューニング
kichikuchi
1
630
AB Tests in Mobile App
kichikuchi
1
2k
Other Decks in Programming
See All in Programming
TSKaigi Night Talks 2026_TypeScriptでサプライチェーンの整合性を型に閉じ込める
geekplus_tech
0
400
Agentic UI
manfredsteyer
PRO
0
180
Make SRE Operations Easier with Azure SRE Agent
kkamegawa
0
7.3k
Java × distroless で 軽量なコンテナイメージを / Java on Distroless
contour_gara
0
550
さぁV100、メモリをお食べ・・・
nilpe
0
150
The ROI of Quarkus for Spring Boot Applications
hollycummins
0
130
RTSPクライアントを自作してみた話
simotin13
0
620
New "Type" system on PicoRuby
pocke
1
990
気づいたらRubyで100作品 ー クリエイティブコーディングが生活の一部になるまで / 100 Ruby Sketches Later: How Creative Coding Became Part of My Life
chobishiba
3
600
並列実装の現場、2ヶ月間実務でAIを使い倒したAIもPCも私も限界が近い
ming_ayami
0
130
Claspは野良GASの夢をみるか
takter00
0
200
AI時代のUIはどこへ行く?その2!
yusukebe
22
7.4k
Featured
See All Featured
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
360
30k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
52
6k
Redefining SEO in the New Era of Traffic Generation
szymonslowik
1
340
How to make the Groovebox
asonas
2
2.2k
How to Align SEO within the Product Triangle To Get Buy-In & Support - #RIMC
aleyda
2
1.5k
A Guide to Academic Writing Using Generative AI - A Workshop
ks91
PRO
1
330
How People are Using Generative and Agentic AI to Supercharge Their Products, Projects, Services and Value Streams Today
helenjbeal
1
220
Taking LLMs out of the black box: A practical guide to human-in-the-loop distillation
inesmontani
PRO
3
2.3k
The B2B funnel & how to create a winning content strategy
katarinadahlin
PRO
1
390
Un-Boring Meetings
codingconduct
0
320
Embracing the Ebb and Flow
colly
88
5.1k
The Illustrated Guide to Node.js - THAT Conference 2024
reverentgeek
1
390
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$ͷΈར༻Մೳͳϝιου͕ଟ