www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - get random number

reply somebody <somebody_member pathlink.com> writes:
how i can get random number on interval from 1 to 100?
Nov 11 2005
parent David L. Davis <SpottedTiger yahoo.com> writes:
In article <dl1lj3$3j3$1 digitaldaemon.com>, somebody says...
how i can get random number on interval from 1 to 100?
Here's something I wrote a year back for my random names and addresses program that you might find useful. It's not perfect, but it does do a pretty good job. Output: ----------------------- C:\dmd>dmd testrandom.d C:\dmd\bin\..\..\dm\bin\link.exe testrandom,,,user32+kernel32/noi; C:\dmd>testrandom List 100 random numbers between 1 to 100. 009, 048, 099, 090, 077, 021, 100, 061, 088, 006, 023, 007, 039, 010, 060, 003, 050, 023, 037, 070, 010, 098, 021, 099, 041, 051, 042, 025, 097, 072, 006, 032, 096, 091, 062, 033, 045, 004, 089, 020, 019, 057, 091, 079, 095, 034, 039, 010, 068, 044, 048, 040, 061, 037, 049, 073, 060, 078, 043, 056, 027, 064, 078, 015, 094, 019, 015, 088, 027, 007, 004, 069, 057, 062, 048, 042, 035, 019, 076, 027, 045, 032, 048, 087, 086, 035, 031, 032, 090, 094, 044, 028, 015, 020, 013, 005, 084, 056, 054, 081, done. C:\dmd> David L. ------------------------------------------------------------------- "Dare to reach for the Stars...Dare to Dream, Build, and Achieve!" ------------------------------------------------------------------- MKoD: http://spottedtiger.tripod.com/D_Language/D_Main_XP.html
Nov 12 2005