Current time: 28 May 2024, 11:56 AM



Generating and Assigning Random ID
Offline SmG Dragonrage

Royal Dragon
Senior Member
******
11 Years of Service
Posts: 4,018
Threads: 206
Likes Received: 0 in 0 posts
Likes Given: 0
Joined: Aug 2012
Reputation: 38
Location: Atlantis
Gavel of TrinityLeague of LegendsProgrammerCoolCrystal DonatorLegendary
#2
Re: Generating and Assigning Random ID

first off, dont return 0 from your randomgen function, and dont use global variables to store your random number. just return the randomcid from the randomgen function. then in your for loop, you are going to have to have an embedded for loop to check to see if the randomcid appears anywhere in the array. if it does you will have to generate a new one, otherwise you can use it. also when declaring your array, make all indexes that you dont want to use 0, that way you can tell if it has been assigned or not, as your randomgen will not produce a 0.
[Image: mla7mw8hs3u0g9czg.jpg?size_id=5]
Do not meddle in the affairs of Dragons, for you are crunchy and taste good with ketchup!
15 Apr 2016, 01:34 PM
Website Find Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)
SmG Gaming, © 2010-2024
Theme By: «SmG» Cloud
Edited by: «SmG» Wires