How to shuffle a TArray?
So I have a deck of cards I need to shuffle. I tried implementing this code: http://stackoverflow.com/a/12646864
The code compiles, but it crashes every time. Anyone know why?
Or something along those lines
When I need to shuffle an array I usually do something like this
It's nice and compact and no extra functions need to be defined.
answered Jun 18 '14 at 11:31 PM
I tried your Shuffle( ) and came up with this solution. Include Math Utilities at the top of your file
The SRandInit seeds the SRand to produce new numbers, even in a packaged game. Put it somewhere before the Shuffle gets used (for example inside BeginPlay)
And the Shuffle( ) function with an updated Floor call
answered Jul 28 '15 at 12:57 AM
Follow this question
Once you sign in you will be able to subscribe for any updates here