Thread: random()
View Single Post
06-06-13, 09:42 AM   #5
ravagernl
Proceritate Corporis
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 1,176
If you dont want to have a number that is following itself (did I explain that correctly) I'm suggesting something like this:
lua Code:
  1. local random
  2. do
  3.     local rand = math.random
  4.     local x, y
  5.     function random(...)
  6.         repeat
  7.             x = rand(...)
  8.         until x ~= y
  9.         y = x
  10.         return x
  11.     end
  12. end

Last edited by ravagernl : 06-07-13 at 09:29 AM. Reason: /golfclap me
  Reply With Quote