SAK }‘ŠÙ
Oracle PL/SQL •Ò11 - —”Adbms_randomAinitializeAseedArandom
¡DBMS_RANDOM EDBMS_RANDOM ‚ÅA—”ƒWƒFƒlƒŒ[ƒ^‚ðŽg—p‚Å‚«‚éB ƒ}ƒjƒ…ƒAƒ‹‚É‚ÍA8 Œ…‚Ì®”‚ª•Ô‚é‚Æ‚È‚Á‚Ä‚¢‚邪AƒeƒXƒg‚·‚é‚Æ 10 Œ… •Ô‚Á‚Ä‚‚éBƒ}ƒCƒiƒX’l‚à‚ ‚é‚Ì‚Å—v’ˆÓ‚Å‚ ‚éB ¡initialize E—”ƒWƒFƒlƒŒ[ƒ^‚ðƒV[ƒh’l‚ʼnŠú‰»‚·‚éB dbms_random.initialize(seed); |_ —”ƒV[ƒh’l(in binary_integer) ¡seed E—”ƒWƒFƒlƒŒ[ƒ^‚ðƒV[ƒh’l‚ÅÄ\¬‚·‚éB dbms_random.seed(seed); |_ —”ƒV[ƒh’l(in binary_integer) ¡random E”¶‚µ‚½—”‚ðŽæ“¾‚·‚éB ret := dbms_random.random(); |_ –ß‚è’l(binary_integer) ¡terminate E—”ƒWƒFƒlƒŒ[ƒ^‚ðI—¹‚·‚éB dbms_random.terminate; EŽŸ‚Ì—á‚ÍAŒ»ÝŽžŠÔ‚ðƒV[ƒh‚Æ‚µ‚ÄA—”ƒWƒFƒlƒŒ[ƒ^‚ð‰Šú‰»‚µ‚ÄŽg—p‚µ ‚Ä‚¢‚éB set serveroutput on; declare todttm char(14); rndinit number; rnd number; begin -- —”ƒV[ƒhì¬ todttm := to_char(sysdate, 'yyyymmddhh24miss'); rndinit := to_number(substr(todttm, 1, 8)) + to_number(substr(todttm, 9, 6)); -- —”ƒWƒFƒlƒŒ[ƒ^‰Šú‰» dbms_random.initialize(rndinit); -- —”ƒWƒFƒlƒŒ[ƒ^ĉŠú‰» dbms_random.seed(rndinit); -- —”Žæ“¾ rnd := dbms_random.random(); dbms_output.put_line ('-- ˆ—Œ‹‰Ê --'); dbms_output.put_line ('—”1 = ' || rnd); -- —”Žæ“¾ rnd := dbms_random.random(); dbms_output.put_line ('—”2 = ' || rnd); -- —”Žæ“¾ rnd := dbms_random.random(); dbms_output.put_line ('—”3 = ' || rnd); -- —”ƒWƒFƒlƒŒ[ƒ^I—¹ dbms_random.terminate; end; / -- ˆ—Œ‹‰Ê -- —”1 = 940632317 —”2 = 1303998716 —”3 = -537697097 EŒ»ŽÀ–â‘è‚Æ‚µ‚ÄA“Á’è‚͈̗̔͂”‚Æ‚·‚é‚É‚ÍAŽŸ‚̂悤‚É‚·‚éB ’A‚µA’Pƒ‚ɉº‚ÌŒ…‚ðØ‚èo‚µ‚Ä‚¢‚邾‚¯‚È‚Ì‚ÅA—”•ª•z‚ª•Î‚é‰Â”\«‚Í ‚ ‚éBketa := 5; ‚ª 5 Œ…‚Ì—”‚Æ‚·‚éŽw’è‚Å‚ ‚éB set serveroutput on; declare todttm char(14); rndinit number; rnd number; keta number := 5; begin -- —”ƒV[ƒhì¬ todttm := to_char(sysdate, 'yyyymmddhh24miss'); rndinit := to_number(substr(todttm, 1, 8)) + to_number(substr(todttm, 9, 6)); -- —”ƒWƒFƒlƒŒ[ƒ^‰Šú‰» dbms_random.initialize(rndinit); -- —”ƒWƒFƒlƒŒ[ƒ^ĉŠú‰» dbms_random.seed(rndinit); -- —”Žæ“¾ rnd := to_number(substr(to_char(dbms_random.random()), - keta, keta)); dbms_output.put_line ('-- ˆ—Œ‹‰Ê --'); dbms_output.put_line ('—”1 = ' || rnd); -- —”Žæ“¾ rnd := to_number(substr(to_char(dbms_random.random()), - keta, keta)); dbms_output.put_line ('—”2 = ' || rnd); -- —”Žæ“¾ rnd := to_number(substr(to_char(dbms_random.random()), - keta, keta)); dbms_output.put_line ('—”3 = ' || rnd); -- —”ƒWƒFƒlƒŒ[ƒ^I—¹ dbms_random.terminate; end; / -- ˆ—Œ‹‰Ê -- —”1 = 32859 —”2 = 70836 —”3 = 60193 ¡Oracle PL/SQL •ÒŽ‘—¿
¡SQL Šî‘bŽÀ’n•ÒŽ‘—¿
¡SQL Šî‘b•ÒŽ‘—¿
¡SQL ƒ`ƒ…[ƒjƒ“ƒO•ÒŽ‘—¿
¡PostgreSQL •ÒAJAVA ServletAJSP •ÒŽ‘—¿
¡MySQL •ÒŽ‘—¿