Skip to main content

All Questions

Tagged with
Filter by
Sorted by
Tagged with
-1 votes
1 answer
2k views

Generating billions of Unique random number [closed]

I recently attended an interview. In that I had to solve the issue for generating an billions of random unique number. For example method signature is as below : public Iterator<Long> ...
MrA's user avatar
  • 111
8 votes
4 answers
37k views

Testing a function that uses random number generator

I have a method which is a part of the interface I am implementing. This method calls another private method which uses a random number generator to produce output and returns it to the calling method....
sayeed910's user avatar
  • 199
2 votes
1 answer
1k views

How to randomly get or find a sub-tree (include root node) from a given tree that contains n leaf-nodes

I have a non-binary tree. I want to randomly find a "sub-trees" that are connected from root to leaf which must have at least n leaf-nodes (leaf-nodes of sub-tree must be leaf-nodes of given tree). ...
Hung Ton's user avatar
  • 123
3 votes
1 answer
186 views

Defining a random "safe" path for a game character

I am writing a game in Java and it can be likened to the recently popular game "Flappy Bird" in the sense that the character moves up and down and the users touch and must avoid the obstacles. The ...
Críostóir Ó Catháin's user avatar
3 votes
2 answers
2k views

Which of these two shuffle algorithms is more random?

Which of below two shuffle algorithms (shuffle1 and shuffle2) is more random? public final class Shuffle { private static Random random; public static void shuffle1(final Object[] array) { ...
robosoul's user avatar
  • 133
5 votes
8 answers
10k views

random generator not good enough?

During an interview I was asked to implement a random generator in java without using any existing random number libraries that takes as an argument int n, and returns a random number between 0 and n. ...
paul smith's user avatar