Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / None-repeated random Numbers

Author
Message
Mr Thicky
21
Years of Service
User Offline
Joined: 21st Nov 2003
Location:
Posted: 21st Nov 2003 23:49
I've only started DB and would like to print out random numbers from 1 to 22 without repeating a number, any help will be appreciated.

cheers
spooky
22
Years of Service
User Offline
Joined: 30th Aug 2002
Location: United Kingdom
Posted: 22nd Nov 2003 00:26
There you go




Boo!
zircher
21
Years of Service
User Offline
Joined: 27th Dec 2002
Location: Oklahoma
Posted: 22nd Nov 2003 21:56
One method that I used in the past was to populate an array and then roll progressively smaller dice. The die roll was not the absolute position in the array but how far to count into the array.

For a deck of cards I'd roll 1d52,1d51, 1d50, etc. Each time a card was 'pulled' I'd mark that spot in the array with a 1. When counting through the array, I'd skip marked spots. The decreaing die roll prevented me from over shooting the array. This method always presents a shuffled deack to the player. A new shuffle is just a quick loop to set all the cards back to 0.
--
TAZ

Login to post a reply

Server time is: 2024-11-25 18:26:19
Your offset time is: 2024-11-25 18:26:19